From adf53cebd22767a9b091bb8ff2666929d590d7cf Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Thu, 6 Feb 2003 17:21:42 +0000 Subject: [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 --- ChangeLog | 15 ++++++++++- etc.c | 8 ++---- file.c | 85 +++++++++++++++++---------------------------------------------- proto.h | 9 +++---- 4 files changed, 43 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4e8933..6de16d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-02-07 Hironori SAKAMOTO + + * [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 * [w3m-dev 03733] Re: display decoded URL @@ -7105,4 +7118,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-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 $ diff --git a/etc.c b/etc.c index 7cab9bb..1b1205b 100644 --- a/etc.c +++ b/etc.c @@ -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 #include "myctype.h" @@ -236,11 +236,7 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color) */ Str -checkType(Str s, Lineprop **oprop -#ifdef USE_ANSI_COLOR - , Linecolor **ocolor -#endif - ) +checkType(Str s, Lineprop **oprop, Linecolor **ocolor) { Lineprop mode; Lineprop effect = PE_NORMAL; diff --git a/file.c b/file.c index 3ab0160..0518bbc 100644 --- a/file.c +++ b/file.c @@ -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 #include "myctype.h" @@ -35,11 +35,11 @@ static FILE *lessopen_stream(char *path); static Buffer *loadcmdout(char *cmd, Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *defaultbuf); -static void addnewline(Buffer *buf, char *line, Lineprop *prop, -#ifdef USE_ANSI_COLOR - Linecolor *color, +#ifndef USE_ANSI_COLOR +#define addnewline(a,b,c,d,e,f,g) _addnewline(a,b,c,e,f,g) #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 JMP_BUF AbortLoading; @@ -654,17 +654,11 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) tmp = Strnew_size(lineBuf2->length); for (p = lineBuf2->ptr; *p; p = q) { for (q = p; *q && *q != '\r' && *q != '\n'; q++) ; - lineBuf2 = checkType(Strnew_charp_n(p, q - p), &propBuffer -#ifdef USE_ANSI_COLOR - , NULL -#endif - ); + lineBuf2 = checkType(Strnew_charp_n(p, q - p), &propBuffer, + NULL); Strcat(tmp, lineBuf2); if (thru) - addnewline(newBuf, lineBuf2->ptr, propBuffer, -#ifdef USE_ANSI_COLOR - NULL, -#endif + addnewline(newBuf, lineBuf2->ptr, propBuffer, NULL, lineBuf2->length, FOLD_BUFFER_WIDTH, -1); for (; *q && (*q == '\r' || *q == '\n'); q++) ; } @@ -910,11 +904,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) lineBuf2 = NULL; } if (thru) - addnewline(newBuf, "", propBuffer, -#ifdef USE_ANSI_COLOR - NULL, -#endif - 0, -1, -1); + addnewline(newBuf, "", propBuffer, NULL, 0, -1, -1); if (src) fclose(src); } @@ -5529,11 +5519,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) } /* end of processing for one line */ if (!internal) - addnewline(buf, outc, outp, -#ifdef USE_ANSI_COLOR - NULL, -#endif - pos, -1, nlines); + addnewline(buf, outc, outp, NULL, pos, -1, nlines); if (internal == HTML_N_INTERNAL) internal = 0; if (str != endp) { @@ -6041,12 +6027,12 @@ HTMLlineproc0(char *line, struct html_feed_environ *h_env, int internal) extern char *NullLine; extern Lineprop NullProp[]; -static void -addnewline2(Buffer *buf, char *line, Lineprop *prop, -#ifdef USE_ANSI_COLOR - Linecolor *color, +#ifndef USE_ANSI_COLOR +#define addnewline2(a,b,c,d,e,f) _addnewline2(a,b,c,e,f) #endif - int pos, int nlines) +static void +addnewline2(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos, + int nlines) { Line *l; l = New(Line); @@ -6085,11 +6071,8 @@ addnewline2(Buffer *buf, char *line, Lineprop *prop, } static void -addnewline(Buffer *buf, char *line, Lineprop *prop, -#ifdef USE_ANSI_COLOR - Linecolor *color, -#endif - int pos, int width, int nlines) +addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos, + int width, int nlines) { char *s; Lineprop *p; @@ -6117,11 +6100,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, c = NULL; } #endif - addnewline2(buf, s, p, -#ifdef USE_ANSI_COLOR - c, -#endif - pos, nlines); + addnewline2(buf, s, p, c, pos, nlines); if (pos <= 0 || width <= 0) return; bpos = 0; @@ -6151,11 +6130,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, c += i; #endif pos -= i; - addnewline2(buf, s, p, -#ifdef USE_ANSI_COLOR - c, -#endif - pos, nlines); + addnewline2(buf, s, p, c, pos, nlines); } } @@ -6841,15 +6816,8 @@ loadBuffer(URLFile *uf, Buffer *volatile newBuf) } ++nlines; Strchop(lineBuf2); - lineBuf2 = checkType(lineBuf2, &propBuffer -#ifdef USE_ANSI_COLOR - , &colorBuffer -#endif - ); - addnewline(newBuf, lineBuf2->ptr, propBuffer, -#ifdef USE_ANSI_COLOR - colorBuffer, -#endif + lineBuf2 = checkType(lineBuf2, &propBuffer, NULL); + addnewline(newBuf, lineBuf2->ptr, propBuffer, colorBuffer, lineBuf2->length, FOLD_BUFFER_WIDTH, nlines); } _end: @@ -7228,15 +7196,8 @@ getNextPage(Buffer *buf, int plen) } ++nlines; Strchop(lineBuf2); - lineBuf2 = checkType(lineBuf2, &propBuffer -#ifdef USE_ANSI_COLOR - , &colorBuffer -#endif - ); - addnewline(buf, lineBuf2->ptr, propBuffer, -#ifdef USE_ANSI_COLOR - colorBuffer, -#endif + lineBuf2 = checkType(lineBuf2, &propBuffer, &colorBuffer); + addnewline(buf, lineBuf2->ptr, propBuffer, colorBuffer, lineBuf2->length, FOLD_BUFFER_WIDTH, nlines); if (!top) { top = buf->firstLine; diff --git a/proto.h b/proto.h index 460663c..1f503f9 100644 --- a/proto.h +++ b/proto.h @@ -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. * 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 *currentLineSkip(Buffer *buf, Line *line, int offset, int last); extern int gethtmlcmd(char **s); -extern Str checkType(Str s, Lineprop **oprop -#ifdef USE_ANSI_COLOR - , Linecolor **ocolor +#ifndef USE_ANSI_COLOR +#define checkType(a,b,c) _checkType(a,b) #endif - ); +extern Str checkType(Str s, Lineprop **oprop, Linecolor **ocolor); extern int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode); extern char *lastFileName(char *path); -- cgit v1.2.3