commit 51d55e5cce11218e5783fdd2a42ac8ba35564dc9
parent 33e2162ef4a5c4fc93b2deee3ae1d5cdbf05700c
Author: ukai <ukai>
Date: Sun, 5 Oct 2003 18:52:50 +0000
fix build error --disbable-m17n
* config.h.in: undef USE_M17N, USE_UNICODE
* etc.c (url_unquote_conv): USE_M17N
* file.c (convertLine): USE_M17N
(loadHTMLStream): fix ifdef USE_IMAGE->USE_M17N
(loadBuffer): fix USE_M17N
(getNextPage): fix USE_M17N
* fm.h (USE_M17N): don't define USE_M17N in case LANG == JA
(this should be done by configure)
(wc_ces): dummy typedef
(wc_Str_conv): fix non-m17n macro args
(wc_Str_conv_strict): ditto
* ftp.c (loadFTPDir): fix undefined USE_M17N
* mimehead.c (decodeWord): ditto
(decodeMIME): ditto
* news.c (loadNewsgroup): ditto
* proto.h (convertLine): ditto
(loadGopherDir): ditto
(loadFTPDir): ditto
(loadNewsgroup): ditto
(decodeWord): ditto
(decodeMIME): ditto
(url_unquote_conv): ditto
* terms.c (SETCH): ditto
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat:
10 files changed, 96 insertions(+), 41 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,32 @@
2003-10-06 Fumitoshi UKAI <ukai@debian.or.jp>
+ * fix build error --disbable-m17n
+ * config.h.in: undef USE_M17N, USE_UNICODE
+ * etc.c (url_unquote_conv): USE_M17N
+ * file.c (convertLine): USE_M17N
+ (loadHTMLStream): fix ifdef USE_IMAGE->USE_M17N
+ (loadBuffer): fix USE_M17N
+ (getNextPage): fix USE_M17N
+ * fm.h (USE_M17N): don't define USE_M17N in case LANG == JA
+ (this should be done by configure)
+ (wc_ces): dummy typedef
+ (wc_Str_conv): fix non-m17n macro args
+ (wc_Str_conv_strict): ditto
+ * ftp.c (loadFTPDir): fix undefined USE_M17N
+ * mimehead.c (decodeWord): ditto
+ (decodeMIME): ditto
+ * news.c (loadNewsgroup): ditto
+ * proto.h (convertLine): ditto
+ (loadGopherDir): ditto
+ (loadFTPDir): ditto
+ (loadNewsgroup): ditto
+ (decodeWord): ditto
+ (decodeMIME): ditto
+ (url_unquote_conv): ditto
+ * terms.c (SETCH): ditto
+
+2003-10-06 Fumitoshi UKAI <ukai@debian.or.jp>
+
* --with-imagelib request on [w3m-dev 03981]
from Mamoru KOMACHI <usata@sodan.ecc.u-tokyo.ac.jp>
* acinclude.m4 (AC_W3M_IMAGE): add --with-imagelib
diff --git a/config.h.in b/config.h.in
@@ -38,8 +38,8 @@
#define DISPLAY_CHARSET @DISPLAY_CHARSET@
#define SYSTEM_CHARSET @SYSTEM_CHARSET@
#define DOCUMENT_CHARSET @DOCUMENT_CHARSET@
-#define USE_M17N
-#define USE_UNICODE
+#undef USE_M17N
+#undef USE_UNICODE
#define W3M_LANG @W3M_LANG@
#define LANG W3M_LANG
diff --git a/etc.c b/etc.c
@@ -1649,8 +1649,13 @@ file_to_url(char *file)
return tmp->ptr;
}
+#ifdef USE_M17N
char *
url_unquote_conv(char *url, wc_ces charset)
+#else
+char *
+url_unquote_conv0(char *url)
+#endif
{
#ifdef USE_M17N
wc_uint8 old_auto_detect = WcOption.auto_detect;
diff --git a/file.c b/file.c
@@ -454,9 +454,14 @@ acceptableEncoding()
/*
* convert line
*/
+#ifdef USE_M17N
Str
convertLine(URLFile *uf, Str line, int mode, wc_ces * charset,
wc_ces doc_charset)
+#else
+Str
+convertLine0(URLFile *uf, Str line, int mode)
+#endif
{
#ifdef USE_M17N
line = wc_Str_conv_with_detect(line, charset, doc_charset, InnerCharset);
@@ -1904,7 +1909,8 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
tmp = tmpfname(TMPF_SRC, ".html");
src = fopen(tmp->ptr, "w");
if (src) {
- Str s = wc_Str_conv_strict(page, InnerCharset, charset);
+ Str s;
+ s = wc_Str_conv_strict(page, InnerCharset, charset);
Strfputs(s, src);
fclose(src);
}
@@ -6597,13 +6603,11 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal)
}
meta_charset = 0;
}
+#endif
lineBuf2 = convertLine(f, lineBuf2, HTML_MODE, &charset, doc_charset);
-#ifdef USE_IMAGE
+#ifdef USE_M17N
cur_document_charset = charset;
#endif
-#else
- lineBuf2 = convertLine(f, lineBuf2, HTML_MODE);
-#endif
HTMLlineproc0(lineBuf2->ptr, &htmlenv1, internal);
}
if (obuf.status != R_ST_NORMAL) {
@@ -6841,12 +6845,8 @@ loadBuffer(URLFile *uf, Buffer *volatile newBuf)
showProgress(&linelen, &trbyte);
if (frame_source)
continue;
-#ifdef USE_M17N
lineBuf2 =
convertLine(uf, lineBuf2, PAGER_MODE, &charset, doc_charset);
-#else
- lineBuf2 = convertLine(uf, lineBuf2, PAGER_MODE);
-#endif
if (squeezeBlankLine) {
if (lineBuf2->ptr[0] == '\n' && pre_lbuf == '\n') {
++nlines;
@@ -7260,12 +7260,8 @@ getNextPage(Buffer *buf, int plen)
}
linelen += lineBuf2->length;
showProgress(&linelen, &trbyte);
-#ifdef USE_M17N
lineBuf2 =
convertLine(&uf, lineBuf2, PAGER_MODE, &charset, doc_charset);
-#else
- lineBuf2 = convertLine(&uf, lineBuf2, PAGER_MODE);
-#endif
if (squeezeBlankLine) {
squeeze_flag = FALSE;
if (lineBuf2->ptr[0] == '\n' && pre_lbuf == '\n') {
diff --git a/fm.h b/fm.h
@@ -39,12 +39,11 @@
#include "html.h"
#include <gc.h>
#include "Str.h"
-#if LANG == JA
-#define USE_M17N
-#endif /* LANG == JA */
#ifdef USE_M17N
#include "wc.h"
#include "wtf.h"
+#else
+typedef int wc_ces; /* XXX: not used */
#endif
#ifdef HAVE_LOCALE_H
@@ -1036,8 +1035,8 @@ global char SearchConv init(TRUE);
#define conv_from_system(x) (x)
#define conv_to_system(x) (x)
#define url_quote_conv(x,c) url_quote(x)
-#define wc_Str_conv(x) (x)
-#define wc_Str_conv_strict(x) (x)
+#define wc_Str_conv(x,charset0,charset1) (x)
+#define wc_Str_conv_strict(x,charset0,charset1) (x)
#endif
global char UseAltEntity init(TRUE);
global char UseGraphicChar init(FALSE);
diff --git a/ftp.c b/ftp.c
@@ -416,8 +416,13 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
return NULL;
}
+#ifdef USE_M17N
Str
loadFTPDir(ParsedURL *pu, wc_ces * charset)
+#else
+Str
+loadFTPDir0(ParsedURL *pu)
+#endif
{
Str FTPDIRtmp;
Str tmp;
diff --git a/mimehead.c b/mimehead.c
@@ -191,8 +191,13 @@ decodeQP(char **ww)
return a;
}
+#ifdef USE_M17N
Str
decodeWord(char **ow, wc_ces * charset)
+#else
+Str
+decodeWord0(char **ow)
+#endif
{
#ifdef USE_M17N
wc_ces c;
@@ -215,7 +220,7 @@ decodeWord(char **ow, wc_ces * charset)
if (!c)
goto convert_fail;
#else
- if (strcasecmp(buf, "ISO-8859-1") != 0 && strcasecmp(buf, "US_ASCII") != 0)
+ if (strcasecmp(tmp->ptr, "ISO-8859-1") != 0 && strcasecmp(tmp->ptr, "US_ASCII") != 0)
/* NOT ISO-8859-1 encoding ... don't convert */
goto convert_fail;
#endif
@@ -255,8 +260,13 @@ decodeWord(char **ow, wc_ces * charset)
/*
* convert MIME encoded string to the original one
*/
+#ifdef USE_M17N
Str
decodeMIME(Str orgstr, wc_ces * charset)
+#else
+Str
+decodeMIME0(Str orgstr)
+#endif
{
char *org = orgstr->ptr, *endp = org + orgstr->length;
char *org0, *p;
diff --git a/news.c b/news.c
@@ -302,8 +302,14 @@ openNewsStream(ParsedURL *pu)
return NULL;
}
+
+#ifdef USE_M17N
Str
loadNewsgroup(ParsedURL *pu, wc_ces * charset)
+#else
+Str
+loadNewsgroup0(ParsedURL *pu)
+#endif
{
volatile Str page;
Str tmp;
diff --git a/proto.h b/proto.h
@@ -168,12 +168,13 @@ extern int dir_exist(char *path);
#ifdef USE_M17N
extern char **get_symbol(wc_ces charset, int *width);
extern char **set_symbol(int width);
+extern Str convertLine(URLFile *uf, Str line, int mode, wc_ces * charset,
+ wc_ces doc_charset);
#else
-#define convertLine(a,b,c,d,e) _convertLine(a,b,c)
extern char **get_symbol(void);
+extern Str convertLine0(URLFile *uf, Str line, int mode);
+#define convertLine(uf,line,mode,charset,dcharset) convertLine0(uf,line,mode)
#endif
-extern Str convertLine(URLFile *uf, Str line, int mode, wc_ces * charset,
- wc_ces doc_charset);
extern void push_symbol(Str str, char symbol, int width, int n);
extern Buffer *loadFile(char *path);
extern Buffer *loadGeneralFile(char *path, ParsedURL *current, char *referer,
@@ -230,9 +231,6 @@ extern void loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src,
int internal);
extern Buffer *loadHTMLString(Str page);
#ifdef USE_GOPHER
-#ifndef USE_M17N
-#define loadGopherDir(a,b,c) _loadGopherDir(a,b)
-#endif
extern Str loadGopherDir(URLFile *uf, ParsedURL *pu, wc_ces * charset);
#endif /* USE_GOPHER */
extern Buffer *loadBuffer(URLFile *uf, Buffer *newBuf);
@@ -522,18 +520,22 @@ extern char *guessContentType(char *filename);
extern TextList *make_domain_list(char *domain_list);
extern int check_no_proxy(char *domain);
extern InputStream openFTPStream(ParsedURL *pu, URLFile *uf);
-#ifndef USE_M17N
-#define loadFTPDir(a,b) _loadFTPDir(a)
-#endif
+#ifdef USE_M17N
extern Str loadFTPDir(ParsedURL *pu, wc_ces * charset);
+#else
+extern Str loadFTPDir0(ParsedURL *pu);
+#define loadFTPDir(pu,charset) loadFTPDir0(pu)
+#endif
extern void closeFTP(void);
extern void disconnectFTP(void);
#ifdef USE_NNTP
extern InputStream openNewsStream(ParsedURL *pu);
-#ifndef USE_M17N
-#define loadNewsgroup(a,b) _loadNewsgroup(a)
-#endif
+#ifdef USE_M17N
extern Str loadNewsgroup(ParsedURL *pu, wc_ces * charset);
+#else
+extern Str loadNewsgroup0(ParsedURL *pu);
+#define loadNewsgroup(pu,charset) loadNewsgroup0(pu)
+#endif
extern void closeNews(void);
extern void disconnectNews(void);
#endif
@@ -578,12 +580,15 @@ extern Str decodeB(char **ww);
extern Str decodeQ(char **ww);
extern Str decodeQP(char **ww);
extern Str decodeU(char **ww);
-#ifndef USE_M17N
-#define decodeWord(a,b) _decodeWord(a)
-#define decodeMIME(a,b) _decodeMIME(a)
-#endif
+#ifdef USE_M17N
extern Str decodeWord(char **ow, wc_ces * charset);
extern Str decodeMIME(Str orgstr, wc_ces * charset);
+#else
+extern Str decodeWord0(char **ow);
+extern Str decodeMIME0(Str orgstr);
+#define decodeWord(ow,charset) decodeWord0(ow)
+#define decodeMIME(orgstr,charset) decodeMIME0(orgstr)
+#endif
extern Str encodeB(char *a);
extern int set_param_option(char *option);
extern char *get_param_option(char *name);
@@ -619,10 +624,12 @@ extern void mySystem(char *command, int background);
extern Str myExtCommand(char *cmd, char *arg, int redirect);
extern Str myEditor(char *cmd, char *file, int line);
extern char *file_to_url(char *file);
-#ifndef USE_M17N
-#define url_unquote_conv(a,b) _url_unquote_conv(a)
-#endif
+#ifdef USE_M17N
extern char *url_unquote_conv(char *url, wc_ces charset);
+#else
+extern char *url_unquote_conv0(char *url);
+#define url_unquote_conv(url, charset) url_unquote_conv0(url)
+#endif
extern char *expandName(char *name);
extern Str tmpfname(int type, char *ext);
extern time_t mymktime(char *timestr);
diff --git a/terms.c b/terms.c
@@ -305,7 +305,7 @@ typedef struct sgttyb TerminalMode;
#define SETCH(var,ch,len) ((var) = New_Reuse(char, (var), (len) + 1), \
strncpy((var), (ch), (len)), (var)[len] = '\0')
#else
-#define SETCH(var,ch) ((var) = (ch))
+#define SETCH(var,ch,len) ((var) = (ch))
#endif
/* Charactor Color */