4
* All rights reserved. Copyright (C) 1996 by NARITA Tomio
5
* $Id: file.h,v 1.8 2004/01/05 07:30:15 nrt Exp $
18
#define LV_PAGE_SIZE 32U /* lines per page */
21
#define BLOCK_SIZE 2 /* segments on memory */
22
#define SLOT_SIZE 1024U /* file location pointers */
25
#define BLOCK_SIZE 4 /* segments on memory */
26
#define SLOT_SIZE 16384U /* file location pointers */
27
#define FRAME_SIZE 4096U
30
#ifdef USE_INTERNAL_IOBUF
31
# define IOBUF_DEFAULT_SIZE 256
42
int heads; /* physical line number */
48
int lines; /* logical line number */
49
line_t line[ LV_PAGE_SIZE ];
74
#ifdef USE_INTERNAL_IOBUF
75
byte buf[ IOBUF_DEFAULT_SIZE ];
83
i_str_t *fileNameI18N;
88
byte inputCodingSystem;
89
byte outputCodingSystem;
90
byte keyboardCodingSystem;
91
byte pathnameCodingSystem;
92
byte defaultCodingSystem;
96
unsigned int lastSegment;
97
unsigned int lastFrame;
98
unsigned long totalLines;
108
boolean_t used[ BLOCK_SIZE ];
109
page_t page[ BLOCK_SIZE ];
110
long *slot[ FRAME_SIZE ];
114
#define line_t line_t far
115
#define page_t page_t far
116
#define file_t file_t far
123
#define Segment( line ) ( (line) / LV_PAGE_SIZE )
124
#define Offset( line ) ( (line) % LV_PAGE_SIZE )
125
#define Block( segment ) ( (segment) % BLOCK_SIZE )
126
#define Slot( segment ) ( (segment) % SLOT_SIZE )
127
#define Frame( segment ) ( (segment) / SLOT_SIZE )
129
public void FileFreeLine( file_t *f );
130
public byte *FileLoadLine( file_t *f, int *length, boolean_t *simple );
132
public file_t *FileAttach( byte *fileName, stream_t *st,
133
int width, int height,
134
byte inputCodingSystem,
135
byte outputCodingSystem,
136
byte keyboardCodingSystem,
137
byte pathnameCodingSystem,
138
byte defaultCodingSystem );
139
public void FilePreload( file_t *f );
141
public boolean_t FileFree( file_t *f );
142
public boolean_t FileDetach( file_t *f );
144
public boolean_t FileStretch( file_t *f, unsigned int target );
145
public boolean_t FileSeek( file_t *f, unsigned int segment );
147
public void FileRefresh( file_t *f );
148
public byte *FileStatus( file_t *f );
149
public byte *FileName( file_t *f );
151
public void FileInit();
153
#ifndef USE_INTERNAL_IOBUF
154
# define IobufGetc( a ) getc( (a)->iop )
155
# define IobufUngetc( a, b ) ungetc( a, (b)->iop )
156
# define IobufFtell( a ) ftell( (a)->iop )
157
# define IobufFseek( a, b, c ) fseek( (a)->iop, b, c)
158
# define IobufFeof( a ) feof( (a)->iop )
160
public inline int IobufGetc( iobuf_t *iobuf );
161
public inline int IobufUngetc( int ch, iobuf_t *iobuf );
162
public long IobufFtell( iobuf_t *iobuf );
163
public int IobufFseek( iobuf_t *iobuf, long off, int mode );
164
public int IobufFeof( iobuf_t *iobuf );
166
#define IobufPutc( a, b ) putc( a, (b)->iop )
168
#endif /* __FILE_H__ */