diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/ctrlcode.h w3m-0.1.11-pre-kokb21/ctrlcode.h --- w3m-0.1.11-pre-kokb20/ctrlcode.h Sun Nov 19 05:02:56 2000 +++ w3m-0.1.11-pre-kokb21/ctrlcode.h Thu Nov 23 20:05:06 2000 @@ -146,6 +146,7 @@ #define IS_KANJI(ch) ((unsigned char)(ch)>=0xa1&&(unsigned char)(ch)<=0xfe) #define IS_INTERNAL_SPACE(ch) ((unsigned char)(ch)>=0x80&&(unsigned char)(ch)<=0xa0) #define IS_INTERNAL_CHAR(ch) IS_INTERNAL_SPACE(ch) +#define IS_CONTROL(ch) (!((ch)&~0x1f)||(ch)==DEL_CODE) /* Local Variables: */ /* c-basic-offset: 4 */ diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/display.c w3m-0.1.11-pre-kokb21/display.c --- w3m-0.1.11-pre-kokb20/display.c Wed Nov 22 06:07:09 2000 +++ w3m-0.1.11-pre-kokb21/display.c Thu Nov 23 20:23:06 2000 @@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.1.1.1.4.3 2000/11/21 21:07:09 okabe Exp $ */ +/* $Id: display.c,v 1.1.1.1.4.4 2000/11/23 11:23:06 okabe Exp $ */ #include #include "fm.h" @@ -585,7 +585,7 @@ } else if (c == DEL_CODE) addstr("^?"); - else if (IS_UNPRINTABLE_CONTROL(c)) { /* Control code */ + else if (IS_UNPRINTABLE_CONTROL(c, mode)) { /* Control code */ addch('^'); addch(c + '@'); } diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/doc-jp/HISTORY.kokb w3m-0.1.11-pre-kokb21/doc-jp/HISTORY.kokb --- w3m-0.1.11-pre-kokb20/doc-jp/HISTORY.kokb Wed Nov 22 19:25:00 2000 +++ w3m-0.1.11-pre-kokb21/doc-jp/HISTORY.kokb Fri Nov 24 12:26:15 2000 @@ -1,3 +1,24 @@ +2000/11/24 +From: Okabe Katsuya + まだファイルを読み込んでないときは, プログレスパーに転送速度を表示 + しないように変更した. + +From: Tsutomu Okada (岡田 勉) +Subject: [w3m-dev 01385] Re: w3m-0.1.11-pre-kokb20 patch + w3m-0111-utf8-kokb20 ですが、conv.c で一箇所間違いと思われるところ + がありましたので、パッチを添付します。ついでに、インデントやコンパ + イル時の warning の修正も一部してあります。 + + +2000/11/23 + +From: Okabe Katsuya + ・StrStream に対しては, 元の Str をそのままバッファとして利用するよ + うに変更. + ・get_ctype をマクロ化し, テーブルを使って判断するようにした. + ・menu.c に返り値が宣言と一致していない所があったので修正. + + 2000/11/22 From: Okabe Katsuya diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/etc.c w3m-0.1.11-pre-kokb21/etc.c --- w3m-0.1.11-pre-kokb20/etc.c Thu Nov 23 01:35:43 2000 +++ w3m-0.1.11-pre-kokb21/etc.c Thu Nov 23 21:42:33 2000 @@ -1,4 +1,4 @@ -/* $Id: etc.c,v 1.8.2.7 2000/11/22 16:35:43 okabe Exp $ */ +/* $Id: etc.c,v 1.8.2.12 2000/11/23 12:42:33 okabe Exp $ */ #include "fm.h" #include #include "myctype.h" @@ -290,7 +290,7 @@ Lineprop *prop = oprop; char *str = s->ptr, *endp = &s->ptr[s->length], *bs = NULL; int do_copy = FALSE; - int size = (s->length > len) ? len : s->length; + int size = (len < s->length) ? len : s->length; if (ShowEffect && (bs = memchr(str, '\b', s->length)) || s->length > size) { @@ -467,7 +467,7 @@ j = (j + Tabstop) / Tabstop * Tabstop; else if (IS_UNPRINTABLE_ASCII(l[i], pr[i])) j = j + 4; - else if (IS_UNPRINTABLE_CONTROL(l[i])) + else if (IS_UNPRINTABLE_CONTROL(l[i], pr[i])) j = j + 2; else j++; @@ -873,24 +873,21 @@ return "unknown"; } -#define is_kanji1(ch) IS_KANJI(ch) -#define is_kanji2(ch) IS_KANJI(ch) +Lineprop CTYPE_MAP[256]; -Lineprop -get_ctype(unsigned char ch, Lineprop prev_mode) +void +initCtypeMap(void) { + int i; + for (i = 0; i < 256; i++) { #ifdef JP_CHARSET - if (prev_mode == PC_KANJI1 && is_kanji2(ch)) - return PC_KANJI2; - - if (is_kanji1(ch)) - return PC_KANJI1; - else -#endif /* JP_CHARSET */ - if (!(ch & ~0x1f) || ch == DEL_CODE) - return PC_CTRL; - else - return PC_ASCII; + if (IS_KANJI(i)) + CTYPE_MAP[i] = (PC_KANJI1|PC_KANJI2); + else +#endif + if (IS_CONTROL(i)) + CTYPE_MAP[i] = PC_CTRL; + } } static char roman_num1[] = diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/file.c w3m-0.1.11-pre-kokb21/file.c --- w3m-0.1.11-pre-kokb20/file.c Wed Nov 22 06:36:03 2000 +++ w3m-0.1.11-pre-kokb21/file.c Fri Nov 24 02:54:30 2000 @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.22.2.28 2000/11/21 21:36:03 okabe Exp $ */ +/* $Id: file.c,v 1.22.2.31 2000/11/23 17:54:30 okabe Exp $ */ #include "fm.h" #include #include "myctype.h" @@ -4694,29 +4694,44 @@ int i, j, rate, duration, eta, pos; static time_t last_time, start_time; time_t cur_time = time(0); + Str messages; + char *fmtrbyte, *fmrate; if (!fmInitialized) return; if (current_content_length > 0) { + double ratio; if (cur_time == last_time) return; last_time = cur_time; if (*trbyte == 0) { move(LASTLINE, 0); clrtoeolx(); - start_time = time(NULL); + start_time = cur_time; } *trbyte += *linelen; *linelen = 0; move(LASTLINE, 0); - duration = time(NULL) - start_time; - rate = duration ? *trbyte / duration : 0; - eta = rate ? (current_content_length - *trbyte) / rate : 0; - addstr(Sprintf("%11s %3.0f%% %7s/s eta %02d:%02d:%02d ", - convert_size2(*trbyte, current_content_length, 1), - 100.0 * (*trbyte) / current_content_length, convert_size(rate, 1), - eta / (60 * 60), (eta / 60) % 60, eta % 60)->ptr); + ratio = 100.0 * (*trbyte) / current_content_length; + fmtrbyte = convert_size2(*trbyte, current_content_length, 1); + duration = cur_time - start_time; + if (duration) { + rate = *trbyte / duration; + fmrate = convert_size(rate, 1); + eta = rate ? (current_content_length - *trbyte) / rate : -1; + messages = Sprintf("%11s %3.0f%% " + "%7s/s " + "eta %02d:%02d:%02d ", + fmtrbyte, ratio, + fmrate, + eta / (60 * 60), (eta / 60) % 60, eta % 60); + } + else { + messages = Sprintf("%11s %3.0f%% ", + fmtrbyte, ratio); + } + addstr(messages->ptr); pos = 42; i = pos + (COLS - pos - 1) * (*trbyte) / current_content_length; move(LASTLINE, pos); @@ -4740,15 +4755,21 @@ if (*trbyte == 0) { move(LASTLINE, 0); clrtoeolx(); - start_time = time(NULL); + start_time = cur_time; } *trbyte += *linelen; *linelen = 0; move(LASTLINE, 0); - duration = time(NULL) - start_time; - rate = duration ? *trbyte / duration : 0; - message(Sprintf("%7s loaded %7s/s\n", - convert_size(*trbyte, 1), convert_size(rate, 1))->ptr, 0, 0); + fmtrbyte = convert_size(*trbyte, 1); + duration = cur_time - start_time; + if (duration) { + fmrate = convert_size(*trbyte / duration, 1); + messages = Sprintf("%7s loaded %7s/s\n", fmtrbyte, fmrate); + } + else { + messages = Sprintf("%7s loaded\n", fmtrbyte); + } + message(messages->ptr, 0, 0); refresh(); } } diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/fm.h w3m-0.1.11-pre-kokb21/fm.h --- w3m-0.1.11-pre-kokb20/fm.h Wed Nov 22 06:07:14 2000 +++ w3m-0.1.11-pre-kokb21/fm.h Thu Nov 23 21:42:33 2000 @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.7.2.15 2000/11/21 21:07:14 okabe Exp $ */ +/* $Id: fm.h,v 1.7.2.18 2000/11/23 12:42:33 okabe Exp $ */ /* * w3m: WWW wo Miru utility * @@ -137,7 +137,7 @@ #define COLPOS(l,c) calcPosition(l->lineBuf,l->propBuf,l->len,c,0,CP_AUTO) -#define IS_UNPRINTABLE_CONTROL(c) (!((c)&~0x1f)&&(c)!=CTRL_I&&(c)!=CTRL_J||(c)==DEL_CODE) +#define IS_UNPRINTABLE_CONTROL(c,m) (CharType(m)==PC_CTRL&&(c)!=CTRL_I&&(c)!=CTRL_J) #ifdef JP_CHARSET #define IS_UNPRINTABLE_ASCII(c,m) ((c)&0x80&&CharType(m)==PC_ASCII) #else @@ -742,6 +742,13 @@ global int clear_buffer init(TRUE); global double pixel_per_char init(DEFAULT_PIXEL_PER_CHAR); global int use_lessopen init(FALSE); + +extern Lineprop CTYPE_MAP[]; +#ifdef JP_CHARSET +#define get_ctype(c,m) (((m)==PC_KANJI1)?(CTYPE_MAP[(unsigned char)(c)]&~PC_KANJI1):(CTYPE_MAP[(unsigned char)(c)]&~PC_KANJI2)) +#else +#define get_ctype(c,m) (CTYPE_MAP[(unsigned char)(c)]) +#endif /* * Externals diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/istream.c w3m-0.1.11-pre-kokb21/istream.c --- w3m-0.1.11-pre-kokb20/istream.c Thu Nov 23 01:35:44 2000 +++ w3m-0.1.11-pre-kokb21/istream.c Fri Nov 24 12:26:05 2000 @@ -1,8 +1,10 @@ -/* $Id: istream.c,v 1.1.2.6 2000/11/22 16:35:44 okabe Exp $ */ +/* $Id: istream.c,v 1.1.2.11 2000/11/24 03:26:05 okabe Exp $ */ #include "fm.h" #include "istream.h" #include +#define uchar unsigned char + #define STREAM_BUF_SIZE 8192 #define SSL_BUF_SIZE 1536 @@ -16,20 +18,23 @@ static void file_close(struct file_handle *handle); static int file_read(struct file_handle *handle, char *buf, int len); -static int str_read(struct str_handle *handle, char *buf, int len); +static int str_read(Str handle, char *buf, int len); +#ifdef USE_SSL static void ssl_close(struct ssl_handle *handle); static int ssl_read(struct ssl_handle *handle, char *buf, int len); +#endif static void init_base_stream(BaseStream base, int bufsize) { StreamBuffer sb = &base->stream; sb->cur = sb->next = 0; - if (bufsize <= 0) - bufsize = STREAM_BUF_SIZE; sb->size = bufsize; - sb->buf = NewAtom_N(char, sb->size); + if (bufsize > 0) + sb->buf = NewAtom_N(uchar, sb->size); + else + sb->buf = NULL; base->iseos = FALSE; } @@ -65,7 +70,7 @@ if (des < 0) return NULL; stream = New(union input_stream); - init_base_stream(&stream->base, 0); + init_base_stream(&stream->base, STREAM_BUF_SIZE); stream->base.type = IST_BASIC; stream->base.handle = New(int); *(int *)stream->base.handle = des; @@ -81,7 +86,7 @@ if (f == NULL) return NULL; stream = New(union input_stream); - init_base_stream(&stream->base, 0); + init_base_stream(&stream->base, STREAM_BUF_SIZE); stream->file.type = IST_FILE; stream->file.handle = New(struct file_handle); stream->file.handle->f = f; @@ -102,10 +107,11 @@ return NULL; stream = New(union input_stream); init_base_stream(&stream->base, 0); + stream->str.stream.next = s->length; + stream->str.stream.size = s->length; + stream->str.stream.buf = s->ptr; stream->str.type = IST_STR; - stream->str.handle = New(struct str_handle); - stream->str.handle->s = s; - stream->str.handle->cur = 0; + stream->str.handle = s; stream->str.read = (int (*)()) str_read; stream->str.close = NULL; return stream; @@ -174,7 +180,7 @@ BaseStream base; StreamBuffer sb; Str s = NULL; - char *p; + uchar *p; int len; if (stream == NULL) @@ -332,15 +338,9 @@ } static int -str_read(struct str_handle *handle, char *buf, int len) +str_read(Str handle, char *buf, int len) { - int i; - char *top = &handle->s->ptr[handle->cur], - *endp = &handle->s->ptr[handle->s->length]; - for (i = 0; &top[i] < endp && i < len; i++) - buf[i] = top[i]; - handle->cur += i; - return i; + return 0; } #ifdef USE_SSL diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/istream.h w3m-0.1.11-pre-kokb21/istream.h --- w3m-0.1.11-pre-kokb20/istream.h Wed Nov 22 19:03:40 2000 +++ w3m-0.1.11-pre-kokb21/istream.h Thu Nov 23 18:54:29 2000 @@ -1,4 +1,4 @@ -/* $Id: istream.h,v 1.1.2.2 2000/11/22 10:03:40 okabe Exp $ */ +/* $Id: istream.h,v 1.1.2.5 2000/11/23 09:54:29 okabe Exp $ */ #ifndef IO_STREAM_H #define IO_STREAM_H @@ -12,8 +12,8 @@ #include struct stream_buffer { - char *buf; - int size, cur, next; + unsigned char *buf; + int size, cur, next; }; typedef struct stream_buffer *StreamBuffer; @@ -23,11 +23,6 @@ void (*close) (); }; -struct str_handle { - Str s; - int cur; -}; - #ifdef USE_SSL struct ssl_handle { SSL *ssl; @@ -55,7 +50,7 @@ struct str_stream { struct stream_buffer stream; - struct str_handle *handle; + Str handle; char type; char iseos; int (*read) (); @@ -114,8 +109,7 @@ #define is_eos(stream) ((stream)->base.iseos) #define file_of(stream) ((stream)->file.handle->f) #define set_close(stream,closep) ((IStype(stream)==IST_FILE)?((stream)->file.handle->close=(closep)):0) -#define str_of(stream) ((stream)->str.handle->s) -#define str_cur_of(stream) ((stream)->str.handle->cur) +#define str_of(stream) ((stream)->str.handle) #ifdef USE_SSL #define ssl_socket_of(stream) ((stream)->ssl.handle->sock) #define ssl_of(stream) ((stream)->ssl.handle->ssl) diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/main.c w3m-0.1.11-pre-kokb21/main.c --- w3m-0.1.11-pre-kokb20/main.c Wed Nov 22 06:07:18 2000 +++ w3m-0.1.11-pre-kokb21/main.c Thu Nov 23 20:42:01 2000 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.8.2.21 2000/11/21 21:07:18 okabe Exp $ */ +/* $Id: main.c,v 1.8.2.23 2000/11/23 11:42:01 okabe Exp $ */ #define MAINPROGRAM #include "fm.h" #include @@ -204,6 +204,7 @@ #ifdef USE_COOKIE initCookie(); #endif /* USE_COOKIE */ + initCtypeMap(); LoadHist = initHist(HIST_SIZE + 1); SaveHist = initHist(HIST_SIZE + 1); diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/menu.c w3m-0.1.11-pre-kokb21/menu.c --- w3m-0.1.11-pre-kokb20/menu.c Wed Nov 8 21:56:25 2000 +++ w3m-0.1.11-pre-kokb21/menu.c Thu Nov 23 22:03:42 2000 @@ -1026,7 +1026,7 @@ if (menuSearchRoutine == NULL) { disp_message ("No previous regular expression", TRUE); - return; + return from; } addstr(menuSearchRoutine == menuForwardSearch ? "Forward: " : "Backward: "); addstr(SearchString); @@ -1331,7 +1331,7 @@ Buffer *buf; if (CurrentMenu->select < 0 || CurrentMenu->select >= SelectMenu.nitem) - return; + return (MENU_NOTHING); for (i = 0, buf = Firstbuf; i < CurrentMenu->select; i++, buf = buf->nextBuffer); if (Currentbuf == buf) Currentbuf = buf->nextBuffer; diff -urN -x CVS -x config.h -x config.param -x XXMakefile -x gc w3m-0.1.11-pre-kokb20/proto.h w3m-0.1.11-pre-kokb21/proto.h --- w3m-0.1.11-pre-kokb20/proto.h Wed Nov 22 06:07:20 2000 +++ w3m-0.1.11-pre-kokb21/proto.h Thu Nov 23 20:42:04 2000 @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.6.2.13 2000/11/21 21:07:20 okabe Exp $ */ +/* $Id: proto.h,v 1.6.2.15 2000/11/23 11:42:04 okabe Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -400,7 +400,7 @@ extern Str find_auth_cookie(char *host, char *realm); extern void add_auth_cookie(char *host, char *realm, Str cookie); extern char *last_modified(Buffer * buf); -extern Lineprop get_ctype(unsigned char, Lineprop); +extern void initCtypeMap(void); extern Str romanNumeral(int n); extern Str romanAlphabet(int n); extern Str quoteShell(char *command);