[w3m-dev 03735] Re: make error of checkType arg

* etc.c (checkType): delete USE_ANSI_COLOR
* file.c (addnewline): macro for USE_ANSI_COLOR
	(readHeader): rewrite of USE_ANSI_COLOR
	(HTMLlineproc2body): ditto
	(addnewline2): ditto
	(addnewline): ditto
	(loadBuffer): ditto
	(getNextPage): ditto
* proto.h (checkType): macro for USE_ANSI_COLOR
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2003-02-06 17:21:42 +00:00
parent 1724907ef8
commit adf53cebd2
4 changed files with 43 additions and 74 deletions
+14 -1
View File
@@ -1,3 +1,16 @@
2003-02-07 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03735] Re: make error of checkType arg
* etc.c (checkType): delete USE_ANSI_COLOR
* file.c (addnewline): macro for USE_ANSI_COLOR
(readHeader): rewrite of USE_ANSI_COLOR
(HTMLlineproc2body): ditto
(addnewline2): ditto
(addnewline): ditto
(loadBuffer): ditto
(getNextPage): ditto
* proto.h (checkType): macro for USE_ANSI_COLOR
2003-02-07 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> 2003-02-07 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03733] Re: display decoded URL * [w3m-dev 03733] Re: display decoded URL
@@ -7105,4 +7118,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.741 2003/02/06 17:16:53 ukai Exp $ $Id: ChangeLog,v 1.742 2003/02/06 17:21:42 ukai Exp $
+2 -6
View File
@@ -1,4 +1,4 @@
/* $Id: etc.c,v 1.63 2003/02/05 16:43:57 ukai Exp $ */ /* $Id: etc.c,v 1.64 2003/02/06 17:21:43 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <pwd.h> #include <pwd.h>
#include "myctype.h" #include "myctype.h"
@@ -236,11 +236,7 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color)
*/ */
Str Str
checkType(Str s, Lineprop **oprop checkType(Str s, Lineprop **oprop, Linecolor **ocolor)
#ifdef USE_ANSI_COLOR
, Linecolor **ocolor
#endif
)
{ {
Lineprop mode; Lineprop mode;
Lineprop effect = PE_NORMAL; Lineprop effect = PE_NORMAL;
+23 -62
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.217 2003/01/30 16:48:43 ukai Exp $ */ /* $Id: file.c,v 1.218 2003/02/06 17:21:43 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -35,11 +35,11 @@ static FILE *lessopen_stream(char *path);
static Buffer *loadcmdout(char *cmd, static Buffer *loadcmdout(char *cmd,
Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *(*loadproc) (URLFile *, Buffer *),
Buffer *defaultbuf); Buffer *defaultbuf);
static void addnewline(Buffer *buf, char *line, Lineprop *prop, #ifndef USE_ANSI_COLOR
#ifdef USE_ANSI_COLOR #define addnewline(a,b,c,d,e,f,g) _addnewline(a,b,c,e,f,g)
Linecolor *color,
#endif #endif
int pos, int width, int nlines); static void addnewline(Buffer *buf, char *line, Lineprop *prop,
Linecolor *color, int pos, int width, int nlines);
static void addLink(Buffer *buf, struct parsed_tag *tag); static void addLink(Buffer *buf, struct parsed_tag *tag);
static JMP_BUF AbortLoading; static JMP_BUF AbortLoading;
@@ -654,17 +654,11 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
tmp = Strnew_size(lineBuf2->length); tmp = Strnew_size(lineBuf2->length);
for (p = lineBuf2->ptr; *p; p = q) { for (p = lineBuf2->ptr; *p; p = q) {
for (q = p; *q && *q != '\r' && *q != '\n'; q++) ; for (q = p; *q && *q != '\r' && *q != '\n'; q++) ;
lineBuf2 = checkType(Strnew_charp_n(p, q - p), &propBuffer lineBuf2 = checkType(Strnew_charp_n(p, q - p), &propBuffer,
#ifdef USE_ANSI_COLOR NULL);
, NULL
#endif
);
Strcat(tmp, lineBuf2); Strcat(tmp, lineBuf2);
if (thru) if (thru)
addnewline(newBuf, lineBuf2->ptr, propBuffer, addnewline(newBuf, lineBuf2->ptr, propBuffer, NULL,
#ifdef USE_ANSI_COLOR
NULL,
#endif
lineBuf2->length, FOLD_BUFFER_WIDTH, -1); lineBuf2->length, FOLD_BUFFER_WIDTH, -1);
for (; *q && (*q == '\r' || *q == '\n'); q++) ; for (; *q && (*q == '\r' || *q == '\n'); q++) ;
} }
@@ -910,11 +904,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
lineBuf2 = NULL; lineBuf2 = NULL;
} }
if (thru) if (thru)
addnewline(newBuf, "", propBuffer, addnewline(newBuf, "", propBuffer, NULL, 0, -1, -1);
#ifdef USE_ANSI_COLOR
NULL,
#endif
0, -1, -1);
if (src) if (src)
fclose(src); fclose(src);
} }
@@ -5529,11 +5519,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
} }
/* end of processing for one line */ /* end of processing for one line */
if (!internal) if (!internal)
addnewline(buf, outc, outp, addnewline(buf, outc, outp, NULL, pos, -1, nlines);
#ifdef USE_ANSI_COLOR
NULL,
#endif
pos, -1, nlines);
if (internal == HTML_N_INTERNAL) if (internal == HTML_N_INTERNAL)
internal = 0; internal = 0;
if (str != endp) { if (str != endp) {
@@ -6041,12 +6027,12 @@ HTMLlineproc0(char *line, struct html_feed_environ *h_env, int internal)
extern char *NullLine; extern char *NullLine;
extern Lineprop NullProp[]; extern Lineprop NullProp[];
static void #ifndef USE_ANSI_COLOR
addnewline2(Buffer *buf, char *line, Lineprop *prop, #define addnewline2(a,b,c,d,e,f) _addnewline2(a,b,c,e,f)
#ifdef USE_ANSI_COLOR
Linecolor *color,
#endif #endif
int pos, int nlines) static void
addnewline2(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
int nlines)
{ {
Line *l; Line *l;
l = New(Line); l = New(Line);
@@ -6085,11 +6071,8 @@ addnewline2(Buffer *buf, char *line, Lineprop *prop,
} }
static void static void
addnewline(Buffer *buf, char *line, Lineprop *prop, addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
#ifdef USE_ANSI_COLOR int width, int nlines)
Linecolor *color,
#endif
int pos, int width, int nlines)
{ {
char *s; char *s;
Lineprop *p; Lineprop *p;
@@ -6117,11 +6100,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop,
c = NULL; c = NULL;
} }
#endif #endif
addnewline2(buf, s, p, addnewline2(buf, s, p, c, pos, nlines);
#ifdef USE_ANSI_COLOR
c,
#endif
pos, nlines);
if (pos <= 0 || width <= 0) if (pos <= 0 || width <= 0)
return; return;
bpos = 0; bpos = 0;
@@ -6151,11 +6130,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop,
c += i; c += i;
#endif #endif
pos -= i; pos -= i;
addnewline2(buf, s, p, addnewline2(buf, s, p, c, pos, nlines);
#ifdef USE_ANSI_COLOR
c,
#endif
pos, nlines);
} }
} }
@@ -6841,15 +6816,8 @@ loadBuffer(URLFile *uf, Buffer *volatile newBuf)
} }
++nlines; ++nlines;
Strchop(lineBuf2); Strchop(lineBuf2);
lineBuf2 = checkType(lineBuf2, &propBuffer lineBuf2 = checkType(lineBuf2, &propBuffer, NULL);
#ifdef USE_ANSI_COLOR addnewline(newBuf, lineBuf2->ptr, propBuffer, colorBuffer,
, &colorBuffer
#endif
);
addnewline(newBuf, lineBuf2->ptr, propBuffer,
#ifdef USE_ANSI_COLOR
colorBuffer,
#endif
lineBuf2->length, FOLD_BUFFER_WIDTH, nlines); lineBuf2->length, FOLD_BUFFER_WIDTH, nlines);
} }
_end: _end:
@@ -7228,15 +7196,8 @@ getNextPage(Buffer *buf, int plen)
} }
++nlines; ++nlines;
Strchop(lineBuf2); Strchop(lineBuf2);
lineBuf2 = checkType(lineBuf2, &propBuffer lineBuf2 = checkType(lineBuf2, &propBuffer, &colorBuffer);
#ifdef USE_ANSI_COLOR addnewline(buf, lineBuf2->ptr, propBuffer, colorBuffer,
, &colorBuffer
#endif
);
addnewline(buf, lineBuf2->ptr, propBuffer,
#ifdef USE_ANSI_COLOR
colorBuffer,
#endif
lineBuf2->length, FOLD_BUFFER_WIDTH, nlines); lineBuf2->length, FOLD_BUFFER_WIDTH, nlines);
if (!top) { if (!top) {
top = buf->firstLine; top = buf->firstLine;
+4 -5
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.89 2003/02/06 17:15:13 ukai Exp $ */ /* $Id: proto.h,v 1.90 2003/02/06 17:21:44 ukai Exp $ */
/* /*
* This file was automatically generated by version 1.7 of cextract. * This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended. * Manual editing not recommended.
@@ -306,11 +306,10 @@ extern int columnLen(Line *line, int column);
extern Line *lineSkip(Buffer *buf, Line *line, int offset, int last); extern Line *lineSkip(Buffer *buf, Line *line, int offset, int last);
extern Line *currentLineSkip(Buffer *buf, Line *line, int offset, int last); extern Line *currentLineSkip(Buffer *buf, Line *line, int offset, int last);
extern int gethtmlcmd(char **s); extern int gethtmlcmd(char **s);
extern Str checkType(Str s, Lineprop **oprop #ifndef USE_ANSI_COLOR
#ifdef USE_ANSI_COLOR #define checkType(a,b,c) _checkType(a,b)
, Linecolor **ocolor
#endif #endif
); extern Str checkType(Str s, Lineprop **oprop, Linecolor **ocolor);
extern int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, extern int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos,
int mode); int mode);
extern char *lastFileName(char *path); extern char *lastFileName(char *path);