[w3m-dev 03686] Re: fold patch

* buffer.c (writeBufferCache): rewrite
	(readBufferCache): rewrite
* etc.c (calcPosition): short -> int realColumn
* fm.h (Line): short -> int len,width,size,bpos,bwidth
	(BufferPoint): short->int pos
	(Buffer): short->int currentColumn,pos,visualpos
	(BufferPos): short->int currentColumn,pos
* frame.h (frameset_queue): short->int pos,currentColumn
* main.c (clear_mark): short->int pos
	(dispincsrch): short->int pos
	(backBf): short->int pos
	(set_buffer_environ): short->int prev_pos
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2003-01-25 17:42:17 +00:00
parent 7119fe00e1
commit 6e58e83e12
6 changed files with 81 additions and 39 deletions
+17 -1
View File
@@ -1,3 +1,19 @@
2003-01-26 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03686] Re: fold patch
* buffer.c (writeBufferCache): rewrite
(readBufferCache): rewrite
* etc.c (calcPosition): short -> int realColumn
* fm.h (Line): short -> int len,width,size,bpos,bwidth
(BufferPoint): short->int pos
(Buffer): short->int currentColumn,pos,visualpos
(BufferPos): short->int currentColumn,pos
* frame.h (frameset_queue): short->int pos,currentColumn
* main.c (clear_mark): short->int pos
(dispincsrch): short->int pos
(backBf): short->int pos
(set_buffer_environ): short->int prev_pos
2003-01-25 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> 2003-01-25 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03684] Re: fold patch * [w3m-dev 03684] Re: fold patch
@@ -6853,4 +6869,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.716 2003/01/24 17:57:07 ukai Exp $ $Id: ChangeLog,v 1.717 2003/01/25 17:42:17 ukai Exp $
+40 -14
View File
@@ -1,4 +1,4 @@
/* $Id: buffer.c,v 1.22 2003/01/24 17:30:50 ukai Exp $ */ /* $Id: buffer.c,v 1.23 2003/01/25 17:42:17 ukai Exp $ */
#include "fm.h" #include "fm.h"
#ifdef USE_MOUSE #ifdef USE_MOUSE
@@ -637,16 +637,25 @@ writeBufferCache(Buffer *buf)
fwrite1(l->usrflags, cache) || fwrite1(l->usrflags, cache) ||
fwrite1(l->width, cache) || fwrite1(l->width, cache) ||
fwrite1(l->len, cache) || fwrite1(l->len, cache) ||
fwrite(l->lineBuf, 1, l->len, cache) < l->len || fwrite1(l->size, cache) ||
fwrite(l->propBuf, sizeof(Lineprop), l->len, cache) < l->len) fwrite1(l->bpos, cache) ||
fwrite1(l->bwidth, cache))
goto _error; goto _error;
if (l->bpos == 0) {
if (fwrite(l->lineBuf, 1, l->size, cache) < l->size ||
fwrite(l->propBuf, sizeof(Lineprop), l->size, cache) < l->size)
goto _error;
}
#ifdef USE_ANSI_COLOR #ifdef USE_ANSI_COLOR
colorflag = l->colorBuf ? 1 : 0; colorflag = l->colorBuf ? 1 : 0;
if (fwrite1(colorflag, cache)) if (fwrite1(colorflag, cache))
goto _error; goto _error;
if (colorflag) { if (colorflag) {
if (fwrite(l->colorBuf, sizeof(Linecolor), l->len, cache) < l->len) if (l->bpos == 0) {
goto _error; if (fwrite(l->colorBuf, sizeof(Linecolor), l->size, cache) <
l->size)
goto _error;
}
} }
#endif #endif
} }
@@ -665,7 +674,7 @@ int
readBufferCache(Buffer *buf) readBufferCache(Buffer *buf)
{ {
FILE *cache; FILE *cache;
Line *l = NULL, *prevl = NULL; Line *l = NULL, *prevl = NULL, *basel = NULL;
long lnum = 0, clnum, tlnum; long lnum = 0, clnum, tlnum;
#ifdef USE_ANSI_COLOR #ifdef USE_ANSI_COLOR
int colorflag; int colorflag;
@@ -696,19 +705,36 @@ readBufferCache(Buffer *buf)
buf->topLine = l; buf->topLine = l;
if (fread1(l->real_linenumber, cache) || if (fread1(l->real_linenumber, cache) ||
fread1(l->usrflags, cache) || fread1(l->usrflags, cache) ||
fread1(l->width, cache) || fread1(l->len, cache)) fread1(l->width, cache) ||
fread1(l->len, cache) ||
fread1(l->size, cache) ||
fread1(l->bpos, cache) ||
fread1(l->bwidth, cache))
break;
if (l->bpos == 0) {
basel = l;
l->lineBuf = NewAtom_N(char, l->size + 1);
fread(l->lineBuf, 1, l->size, cache);
l->lineBuf[l->size] = '\0';
l->propBuf = NewAtom_N(Lineprop, l->size);
fread(l->propBuf, sizeof(Lineprop), l->size, cache);
}
else if (basel) {
l->lineBuf = basel->lineBuf + l->bpos;
l->propBuf = basel->propBuf + l->bpos;
}
else
break; break;
l->lineBuf = NewAtom_N(char, l->len + 1);
fread(l->lineBuf, 1, l->len, cache);
l->lineBuf[l->len] = '\0';
l->propBuf = NewAtom_N(Lineprop, l->len);
fread(l->propBuf, sizeof(Lineprop), l->len, cache);
#ifdef USE_ANSI_COLOR #ifdef USE_ANSI_COLOR
if (fread1(colorflag, cache)) if (fread1(colorflag, cache))
break; break;
if (colorflag) { if (colorflag) {
l->colorBuf = NewAtom_N(Linecolor, l->len); if (l->bpos == 0) {
fread(l->colorBuf, sizeof(Linecolor), l->len, cache); l->colorBuf = NewAtom_N(Linecolor, l->size);
fread(l->colorBuf, sizeof(Linecolor), l->size, cache);
}
else
l->colorBuf = basel->colorBuf + l->bpos;
} }
else { else {
l->colorBuf = NULL; l->colorBuf = NULL;
+3 -3
View File
@@ -1,4 +1,4 @@
/* $Id: etc.c,v 1.59 2003/01/23 18:38:06 ukai Exp $ */ /* $Id: etc.c,v 1.60 2003/01/25 17:42:17 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <pwd.h> #include <pwd.h>
#include "myctype.h" #include "myctype.h"
@@ -481,7 +481,7 @@ checkType(Str s, Lineprop **oprop
int int
calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode)
{ {
static short *realColumn = NULL; static int *realColumn = NULL;
static int size = 0; static int size = 0;
static char *prevl = NULL; static char *prevl = NULL;
int i, j; int i, j;
@@ -494,7 +494,7 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode)
} }
if (size < len + 1) { if (size < len + 1) {
size = (len + 1 > LINELEN) ? (len + 1) : LINELEN; size = (len + 1 > LINELEN) ? (len + 1) : LINELEN;
realColumn = New_Reuse(short, realColumn, size); realColumn = New_Reuse(int, realColumn, size);
} }
prevl = l; prevl = l;
j = bpos; j = bpos;
+12 -12
View File
@@ -1,4 +1,4 @@
/* $Id: fm.h,v 1.107 2003/01/23 18:37:20 ukai Exp $ */ /* $Id: fm.h,v 1.108 2003/01/25 17:42:17 ukai Exp $ */
/* /*
* w3m: WWW wo Miru utility * w3m: WWW wo Miru utility
* *
@@ -310,19 +310,19 @@ typedef struct _Line {
#endif #endif
struct _Line *next; struct _Line *next;
struct _Line *prev; struct _Line *prev;
short len; int len;
short width; int width;
long linenumber; /* on buffer */ long linenumber; /* on buffer */
long real_linenumber; /* on file */ long real_linenumber; /* on file */
unsigned short usrflags; unsigned short usrflags;
short size; int size;
short bpos; int bpos;
short bwidth; int bwidth;
} Line; } Line;
typedef struct { typedef struct {
int line; int line;
short pos; int pos;
} BufferPoint; } BufferPoint;
#ifdef USE_IMAGE #ifdef USE_IMAGE
@@ -413,11 +413,11 @@ typedef struct _Buffer {
char *real_type; char *real_type;
int allLine; int allLine;
short bufferprop; short bufferprop;
short currentColumn; int currentColumn;
short cursorX; short cursorX;
short cursorY; short cursorY;
short pos; int pos;
short visualpos; int visualpos;
short rootX; short rootX;
short rootY; short rootY;
short COLS; short COLS;
@@ -469,8 +469,8 @@ typedef struct _Buffer {
typedef struct _BufferPos { typedef struct _BufferPos {
long top_linenumber; long top_linenumber;
long cur_linenumber; long cur_linenumber;
short currentColumn; int currentColumn;
short pos; int pos;
struct _BufferPos *next; struct _BufferPos *next;
struct _BufferPos *prev; struct _BufferPos *prev;
} BufferPos; } BufferPos;
+3 -3
View File
@@ -1,4 +1,4 @@
/* $Id: frame.h,v 1.5 2003/01/09 15:30:46 ukai Exp $ */ /* $Id: frame.h,v 1.6 2003/01/25 17:42:17 ukai Exp $ */
/* /*
* frame support * frame support
*/ */
@@ -54,8 +54,8 @@ struct frameset_queue {
struct frameset *frameset; struct frameset *frameset;
long linenumber; long linenumber;
long top_linenumber; long top_linenumber;
short pos; int pos;
short currentColumn; int currentColumn;
struct _anchorList *formitem; struct _anchorList *formitem;
}; };
+6 -6
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.199 2003/01/23 18:38:08 ukai Exp $ */ /* $Id: main.c,v 1.200 2003/01/25 17:42:17 ukai Exp $ */
#define MAINPROGRAM #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -1545,7 +1545,7 @@ rdrwSc(void)
static void static void
clear_mark(Line *l) clear_mark(Line *l)
{ {
short pos; int pos;
if (!l) if (!l)
return; return;
for (pos = 0; pos < l->size; pos++) for (pos = 0; pos < l->size; pos++)
@@ -1592,7 +1592,7 @@ dispincsrch(int ch, Str buf, Lineprop *prop)
{ {
static Buffer sbuf; static Buffer sbuf;
static Line *currentLine; static Line *currentLine;
static short pos; static int pos;
char *str; char *str;
int do_next_search = FALSE; int do_next_search = FALSE;
@@ -3770,8 +3770,8 @@ backBf(void)
struct frameset *fs; struct frameset *fs;
long linenumber = buf->frameQ->linenumber; long linenumber = buf->frameQ->linenumber;
long top = buf->frameQ->top_linenumber; long top = buf->frameQ->top_linenumber;
short pos = buf->frameQ->pos; int pos = buf->frameQ->pos;
short currentColumn = buf->frameQ->currentColumn; int currentColumn = buf->frameQ->currentColumn;
AnchorList *formitem = buf->frameQ->formitem; AnchorList *formitem = buf->frameQ->formitem;
fs = popFrameTree(&(buf->frameQ)); fs = popFrameTree(&(buf->frameQ));
@@ -5344,7 +5344,7 @@ set_buffer_environ(Buffer *buf)
{ {
static Buffer *prev_buf = NULL; static Buffer *prev_buf = NULL;
static Line *prev_line = NULL; static Line *prev_line = NULL;
static short prev_pos = -1; static int prev_pos = -1;
Line *l; Line *l;
if (buf == NULL) if (buf == NULL)