[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>
* [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 $
+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 <pwd.h>
#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;
+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 <sys/types.h>
#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;
+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.
* 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);