aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-25 17:42:17 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-25 17:42:17 +0000
commit6e58e83e1237f1d9ba3dda1aa0cb054253bc4d0e (patch)
treecbccee3a42bd309dd2fe85a5dbbb1b12ba29bfb7
parentfix indent (diff)
downloadw3m-6e58e83e1237f1d9ba3dda1aa0cb054253bc4d0e.tar.gz
w3m-6e58e83e1237f1d9ba3dda1aa0cb054253bc4d0e.zip
[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>
-rw-r--r--ChangeLog18
-rw-r--r--buffer.c54
-rw-r--r--etc.c6
-rw-r--r--fm.h24
-rw-r--r--frame.h6
-rw-r--r--main.c12
6 files changed, 81 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d717a7..3844d2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* [w3m-dev 03684] Re: fold patch
@@ -6853,4 +6869,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-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 $
diff --git a/buffer.c b/buffer.c
index de1908f..e4b929b 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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"
#ifdef USE_MOUSE
@@ -637,16 +637,25 @@ writeBufferCache(Buffer *buf)
fwrite1(l->usrflags, cache) ||
fwrite1(l->width, cache) ||
fwrite1(l->len, cache) ||
- fwrite(l->lineBuf, 1, l->len, cache) < l->len ||
- fwrite(l->propBuf, sizeof(Lineprop), l->len, cache) < l->len)
+ fwrite1(l->size, cache) ||
+ fwrite1(l->bpos, cache) ||
+ fwrite1(l->bwidth, cache))
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
colorflag = l->colorBuf ? 1 : 0;
if (fwrite1(colorflag, cache))
goto _error;
if (colorflag) {
- if (fwrite(l->colorBuf, sizeof(Linecolor), l->len, cache) < l->len)
- goto _error;
+ if (l->bpos == 0) {
+ if (fwrite(l->colorBuf, sizeof(Linecolor), l->size, cache) <
+ l->size)
+ goto _error;
+ }
}
#endif
}
@@ -665,7 +674,7 @@ int
readBufferCache(Buffer *buf)
{
FILE *cache;
- Line *l = NULL, *prevl = NULL;
+ Line *l = NULL, *prevl = NULL, *basel = NULL;
long lnum = 0, clnum, tlnum;
#ifdef USE_ANSI_COLOR
int colorflag;
@@ -696,19 +705,36 @@ readBufferCache(Buffer *buf)
buf->topLine = l;
if (fread1(l->real_linenumber, 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;
- 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
if (fread1(colorflag, cache))
break;
if (colorflag) {
- l->colorBuf = NewAtom_N(Linecolor, l->len);
- fread(l->colorBuf, sizeof(Linecolor), l->len, cache);
+ if (l->bpos == 0) {
+ l->colorBuf = NewAtom_N(Linecolor, l->size);
+ fread(l->colorBuf, sizeof(Linecolor), l->size, cache);
+ }
+ else
+ l->colorBuf = basel->colorBuf + l->bpos;
}
else {
l->colorBuf = NULL;
diff --git a/etc.c b/etc.c
index 26fcc41..62b8f25 100644
--- a/etc.c
+++ b/etc.c
@@ -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 <pwd.h>
#include "myctype.h"
@@ -481,7 +481,7 @@ checkType(Str s, Lineprop **oprop
int
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 char *prevl = NULL;
int i, j;
@@ -494,7 +494,7 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode)
}
if (size < len + 1) {
size = (len + 1 > LINELEN) ? (len + 1) : LINELEN;
- realColumn = New_Reuse(short, realColumn, size);
+ realColumn = New_Reuse(int, realColumn, size);
}
prevl = l;
j = bpos;
diff --git a/fm.h b/fm.h
index 1d4bcff..b4925c9 100644
--- a/fm.h
+++ b/fm.h
@@ -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
*
@@ -310,19 +310,19 @@ typedef struct _Line {
#endif
struct _Line *next;
struct _Line *prev;
- short len;
- short width;
+ int len;
+ int width;
long linenumber; /* on buffer */
long real_linenumber; /* on file */
unsigned short usrflags;
- short size;
- short bpos;
- short bwidth;
+ int size;
+ int bpos;
+ int bwidth;
} Line;
typedef struct {
int line;
- short pos;
+ int pos;
} BufferPoint;
#ifdef USE_IMAGE
@@ -413,11 +413,11 @@ typedef struct _Buffer {
char *real_type;
int allLine;
short bufferprop;
- short currentColumn;
+ int currentColumn;
short cursorX;
short cursorY;
- short pos;
- short visualpos;
+ int pos;
+ int visualpos;
short rootX;
short rootY;
short COLS;
@@ -469,8 +469,8 @@ typedef struct _Buffer {
typedef struct _BufferPos {
long top_linenumber;
long cur_linenumber;
- short currentColumn;
- short pos;
+ int currentColumn;
+ int pos;
struct _BufferPos *next;
struct _BufferPos *prev;
} BufferPos;
diff --git a/frame.h b/frame.h
index 9ebdabd..597c8cb 100644
--- a/frame.h
+++ b/frame.h
@@ -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
*/
@@ -54,8 +54,8 @@ struct frameset_queue {
struct frameset *frameset;
long linenumber;
long top_linenumber;
- short pos;
- short currentColumn;
+ int pos;
+ int currentColumn;
struct _anchorList *formitem;
};
diff --git a/main.c b/main.c
index 586dc1f..2f12fc5 100644
--- a/main.c
+++ b/main.c
@@ -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
#include "fm.h"
#include <signal.h>
@@ -1545,7 +1545,7 @@ rdrwSc(void)
static void
clear_mark(Line *l)
{
- short pos;
+ int pos;
if (!l)
return;
for (pos = 0; pos < l->size; pos++)
@@ -1592,7 +1592,7 @@ dispincsrch(int ch, Str buf, Lineprop *prop)
{
static Buffer sbuf;
static Line *currentLine;
- static short pos;
+ static int pos;
char *str;
int do_next_search = FALSE;
@@ -3770,8 +3770,8 @@ backBf(void)
struct frameset *fs;
long linenumber = buf->frameQ->linenumber;
long top = buf->frameQ->top_linenumber;
- short pos = buf->frameQ->pos;
- short currentColumn = buf->frameQ->currentColumn;
+ int pos = buf->frameQ->pos;
+ int currentColumn = buf->frameQ->currentColumn;
AnchorList *formitem = buf->frameQ->formitem;
fs = popFrameTree(&(buf->frameQ));
@@ -5344,7 +5344,7 @@ set_buffer_environ(Buffer *buf)
{
static Buffer *prev_buf = NULL;
static Line *prev_line = NULL;
- static short prev_pos = -1;
+ static int prev_pos = -1;
Line *l;
if (buf == NULL)