~ubuntu-branches/ubuntu/trusty/lv/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/20051030_%src%_~use_off_t.diff/src/file.h

  • Committer: Package Import Robot
  • Author(s): HIGUCHI Daisuke (VDR dai)
  • Date: 2014-03-15 03:42:28 UTC
  • Revision ID: package-import@ubuntu.com-20140315034228-6lcwgjiug8rym3wc
Tags: 4.51-2.2
* Non-maintainer upload.
* debian/control, debian/rules, debian/compat: use dh9.
* debian/control
  - add Vcs-* tags.
  - add Homepage: tag.
  - add ${misc:Depends} to Depends:.
  - add xz-utils to Recommends:.
* debian/source/format: set 3.0 (quilt).
* debian/patches/*: rename from debian/patch* and add DEP-3 headers.
* debian/copyright: convert to DEP-5.
* debian/patches/fix-hyphen-used-as-minus-sign.diff: new file.
* debian/lv.doc-base: new file.
* bump up Standards-Version 3.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * file.h
 
3
 *
 
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 $
 
6
 */
 
7
 
 
8
#ifndef __FILE_H__
 
9
#define __FILE_H__
 
10
 
 
11
#include <stdio.h>
 
12
 
 
13
#include <itable.h>
 
14
#include <ctable.h>
 
15
#include <str.h>
 
16
#include <stream.h>
 
17
 
 
18
#define LV_PAGE_SIZE    32U             /* lines per page */
 
19
 
 
20
#ifdef MSDOS
 
21
#define BLOCK_SIZE      2               /* segments on memory */
 
22
#define SLOT_SIZE       1024U           /* file location pointers */
 
23
#define FRAME_SIZE      2U
 
24
#else
 
25
#define BLOCK_SIZE      4               /* segments on memory */
 
26
#define SLOT_SIZE       16384U          /* file location pointers */
 
27
#define FRAME_SIZE      4096U
 
28
#endif /* MSDOS */
 
29
 
 
30
#ifdef USE_INTERNAL_IOBUF
 
31
# define IOBUF_DEFAULT_SIZE     256
 
32
#endif
 
33
 
 
34
typedef struct {
 
35
  int           ptr;
 
36
  int           width;
 
37
  boolean_t     hit;
 
38
} head_t;
 
39
 
 
40
typedef struct {
 
41
  i_str_t       *istr;
 
42
  int           heads;                  /* physical line number */
 
43
  head_t        *head;
 
44
} line_t;
 
45
 
 
46
typedef struct {
 
47
  unsigned int  segment;
 
48
  int           lines;                  /* logical line number */
 
49
  line_t        line[ LV_PAGE_SIZE ];
 
50
} page_t;
 
51
 
 
52
typedef struct {
 
53
  unsigned int  seg;
 
54
  int           blk;
 
55
  int           off;
 
56
  int           phy;
 
57
} position_t;
 
58
 
 
59
typedef struct {
 
60
  position_t    top;
 
61
  position_t    bot;
 
62
  int           lines;
 
63
} screen_t;
 
64
 
 
65
typedef struct {
 
66
  position_t    pos;
 
67
  i_str_t       *pattern;
 
68
  boolean_t     first;
 
69
  boolean_t     displayed;
 
70
} find_t;
 
71
 
 
72
typedef struct {
 
73
  FILE          *iop;
 
74
#ifdef USE_INTERNAL_IOBUF
 
75
  byte          buf[ IOBUF_DEFAULT_SIZE ];
 
76
  size_t        cur;
 
77
  size_t        last;
 
78
#endif
 
79
} iobuf_t;
 
80
 
 
81
typedef struct {
 
82
  byte          *fileName;
 
83
  i_str_t       *fileNameI18N;
 
84
  int           fileNameLength;
 
85
  iobuf_t       fp;
 
86
  iobuf_t       sp;
 
87
  int           pid;
 
88
  byte          inputCodingSystem;
 
89
  byte          outputCodingSystem;
 
90
  byte          keyboardCodingSystem;
 
91
  byte          pathnameCodingSystem;
 
92
  byte          defaultCodingSystem;
 
93
  byte          dummy;
 
94
  int           width;
 
95
  int           height;
 
96
  unsigned int  lastSegment;
 
97
  unsigned int  lastFrame;
 
98
  unsigned long totalLines;
 
99
  long          lastPtr;
 
100
  boolean_t     done;
 
101
  boolean_t     eof;
 
102
  boolean_t     top;
 
103
  boolean_t     bottom;
 
104
  boolean_t     truncated;
 
105
  boolean_t     dirty;
 
106
  find_t        find;
 
107
  screen_t      screen;
 
108
  boolean_t     used[ BLOCK_SIZE ];
 
109
  page_t        page[ BLOCK_SIZE ];
 
110
  long          *slot[ FRAME_SIZE ];
 
111
} file_t;
 
112
 
 
113
#ifdef MSDOS
 
114
#define line_t line_t far
 
115
#define page_t page_t far
 
116
#define file_t file_t far
 
117
#else
 
118
#ifndef far
 
119
#define far
 
120
#endif /* far */
 
121
#endif /* MSDOS */
 
122
 
 
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 )
 
128
 
 
129
public void FileFreeLine( file_t *f );
 
130
public byte *FileLoadLine( file_t *f, int *length, boolean_t *simple );
 
131
 
 
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 );
 
140
 
 
141
public boolean_t FileFree( file_t *f );
 
142
public boolean_t FileDetach( file_t *f );
 
143
 
 
144
public boolean_t FileStretch( file_t *f, unsigned int target );
 
145
public boolean_t FileSeek( file_t *f, unsigned int segment );
 
146
 
 
147
public void FileRefresh( file_t *f );
 
148
public byte *FileStatus( file_t *f );
 
149
public byte *FileName( file_t *f );
 
150
 
 
151
public void FileInit();
 
152
 
 
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 )
 
159
#else
 
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 );
 
165
#endif
 
166
#define IobufPutc( a, b )       putc( a, (b)->iop )
 
167
 
 
168
#endif /* __FILE_H__ */