w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

utiliof.h
Go to the documentation of this file.
1 
2 #ifndef UTIL_IOF_H
3 #define UTIL_IOF_H
4 
5 #include <stdio.h> // for FILE *
6 #include <errno.h> // for errno
7 #include <string.h> // for strerror()
8 #include <stdint.h> // for uintN_t
9 
10 #include "utildecl.h"
11 #include "utilnumber.h"
12 
13 /* handler call modes */
14 
15 typedef enum {
16  IOFREAD = 0, /* read to buffer */
17  IOFLOAD = 1, /* read all to buffer */
18  IOFWRITE = 2, /* write buffer to the output */
19  IOFFLUSH = 3, /* flush buffer to the output */
20  IOFCLOSE = 4 /* (flush and) close */
22 
23 /* return statuses */
24 
25 typedef enum {
26  IOFEOF = -1, /* end of input */
27  IOFEMPTY = -2, /* end of input buffer*/
28  IOFFULL = -3, /* end of output buffer */
29  IOFERR = -4 /* error */
31 
33 
34 /* iof_file */
35 
36 typedef struct iof_file {
37  union {
38  FILE *iofh; // access via iof_file_get_fh / iof_file_set_fh (below)
39  union {
40  struct { uint8_t *buf, *pos, *end; };
41  struct { const uint8_t *rbuf, *rpos, *rend; }; // to trick compiler warnings about cast discarding const
42  };
43  };
44  size_t *offset;
45  char *name;
46  size_t size;
47  int refcount;
48  int flags;
50 
51 /* iof handler function */
52 
53 typedef struct iof iof;
55 
56 /* iof structure; keep 8N bytes */
57 
58 #define IOF_MEMBERS \
59  union { \
60  struct { uint8_t *buf, *pos, *end; }; \
61  struct { uint16_t *hbuf, *hpos, *hend; }; \
62  struct { uint32_t *ibuf, *ipos, *iend; }; \
63  struct { const uint8_t *rbuf, *rpos, *rend; }; \
64  }; \
65  size_t space; \
66  iof_handler more; \
67  union { void *link; iof *next; FILE *file; iof_file *iofile; }; \
68  int flags; \
69  int refcount
70 
71 /*
72  buf -- the beginning of buffer
73  pos -- the current position
74  end -- the end of buffer
75  space -- private space size, not always eq. (end - buf)
76  more -- handler function
77  next/file/iofile/link -- reader source or writer target
78  source -- source filter
79  flags -- private filter info
80  refcount -- refcount
81 */
82 
83 struct iof {
85 };
86 
87 typedef void (*iof_dump_function) (const void *value, iof *O);
88 
89 /* flags */
90 
91 #define IOF_ALLOC (1<<0) // iof is allocated
92 #define IOF_HEAP (1<<1) // iof taken from iof heap
93 #define IOF_BUFFER_ALLOC (1<<2) // buffer allocated
94 #define IOF_BUFFER_HEAP (1<<3) // buffer taken from iof heap
95 
96 #define IOF_SHORT (1<<4) // buffer uses 16bit integers
97 #define IOF_LONG (1<<5) // buffer uses 32bit integers
98 
99 #define IOF_TAIL (1<<6) // preserve reader tail
100 #define IOF_READER (1<<7) // is reader
101 #define IOF_WRITER (1<<8) // is writer
102 
103 #define IOF_DATA (1<<9) // binds some memory
104 #define IOF_FILE_HANDLE (1<<10) // links FILE *
105 #define IOF_FILE (1<<11) // links iof_file *
106 #define IOF_NEXT (1<<12) // links next iof *
107 #define IOF_CLOSE_FILE (1<<13) // close FILE * on free
108 #define IOF_REOPEN_FILE (1<<14) // close/reopen mode for iof_file
109 #define IOF_RECLOSE_FILE (1<<15) // ditto
110 
111 #define IOF_STOPPED (1<<16) // stopped
112 
113 // #define IOF_CUSTOM (1<<17) // first custom flag
114 
115 #define IOF_BUFSIZ (sizeof(iof) + BUFSIZ*sizeof(uint8_t))
116 
117 /*
118 reading buffer -- all of buf, pos, end pointers are initialized to the beginning of the private buffer,
119  next call to a handler function moves the end pointer to bufer+space
120 writer -- buf and pos pointers initialized to the beginning of the buffer, end initialized to bufer+space
121 
122 Every call to handler returns size_t number of bytes
123 available (to write/read) or 0 if there is no more space.
124 
125 We usually align the data buffer just after the iof structure.
126 This is convenient, especially when a memory for the structure
127 and its buffer is to be allocated. In the case of growing output
128 buffers we used to check if the memory of the buffer is allocated
129 by the handler function using test (O->buf != (O+1)). We don't use
130 it any longer not to rely on little secrets. Now there is an explicit
131 IOF_BUFFER_ALLOC flag for that. IOF_ALLOC tells if the structure
132 itself is taken from malloc (not used so far). Assuming the buffer size
133 is way larger the sizeof(iof)
134 */
135 
136 /* initializers */
137 
138 #define IOF_READER_INIT(handler, file, buffer, size, flags) \
139  { {{ (uint8_t *)(buffer), (uint8_t *)(buffer), (uint8_t *)(buffer) }}, size, handler, { file }, (flags)|IOF_READER, 0 }
140 
141 #define IOF_WRITER_INIT(handler, file, buffer, size, flags) \
142  { {{ (uint8_t *)(buffer), (uint8_t *)(buffer), (uint8_t *)(buffer) + size }}, size, handler, { file }, (flags)|IOF_WRITER, 0 }
143 
144 #define IOF_STRING_INIT(buffer, size) \
145  { {{ (uint8_t *)(buffer), (uint8_t *)(buffer), (uint8_t *)(buffer) + size }}, size, NULL, { NULL }, 0|IOF_READER|IOF_DATA, 0 }
146 
147 #define IOF_STRING() IOF_STRING_INIT(0, 0)
148 
149 /* refcount */
150 
151 #define iof_incref(I) (++(I)->refcount)
152 #define iof_decref(I) ((void)(--(I)->refcount <= 0 && iof_close(I)))
153 #define iof_unref(I) (--(I)->refcount)
154 
155 /* binding buffer of a given size */
156 
157 #define iof_setup_reader(I, buffer, size) \
158  ((I)->buf = (I)->pos = (I)->end = (uint8_t *)(buffer), \
159  (I)->space = size, (I)->flags = 0|IOF_READER, (I)->refcount = 0)
160 
161 #define iof_setup_writer(O, buffer, size) \
162  ((O)->buf = (O)->pos = (uint8_t *)(buffer), \
163  (O)->end = (uint8_t *)(buffer) + size, \
164  (O)->space = size, (O)->flags = 0|IOF_WRITER, (O)->refcount = 0)
165 
166 /* basics */
167 
168 #define iof_space(I) ((I)->end - (I)->buf)
169 #define iof_left(I) ((I)->end - (I)->pos)
170 #define iof_size(I) ((I)->pos - (I)->buf)
171 
172 #define iof_input(I) ((I)->more ? (I)->more((I), IOFREAD) : 0lu)
173 #define iof_load(I) ((I)->more ? (I)->more((I), IOFLOAD) : 0lu)
174 
175 #define iof_output(O) ((O)->more ? (O)->more((O), IOFWRITE) : 0lu)
176 //#define iof_flush(O) ((O)->pos > (O)->buf && (O)->more ? (O)->more(O, IOFFLUSH) : 0lu)
177 // flush should be unconditional, because encoders emits EOD markers only on flush
178 #define iof_flush(O) ((O)->more ? (O)->more(O, IOFFLUSH) : 0lu)
179 #define iof_close(O) ((O)->more ? (O)->more(O, IOFCLOSE) : 0lu)
180 
181 #define iof_stop(F) ((void)(F->pos = F->end = F->buf, F->flags |= IOF_STOPPED))
182 
183 /*
184 Rewriting reader tail to the beginning of new data portion; readers reacting on IOFREAD
185 mode must be aware of some not yet read data, but treat it necessary only if IOF_TAIL flag is set.
186 Parsers using iof input may protect not yet read data when there may be a need to put bytes
187 back to the stream. This is trivial when I->pos > I->buf, as we can make a move by --I->pos.
188 But when there is a need to put back more then one byte, we can protect the data tail, so that
189 realoder will rewrite it to the beginning of new data chunk.
190 
191  iof_tail(I) - internal, used by iof handlers at IOFREAD mode
192  iof_protect_tail(I) - used by parsers to ensure some bytes chunk in one piece
193 
194 */
195 
196 size_t iof_save_tail (iof *I);
197 #define iof_tail(I) (((I)->flags & IOF_TAIL) && (I)->pos < (I)->end ? iof_save_tail(I) : 0)
198 
199 size_t iof_input_save_tail (iof *I, size_t back);
200 #define iof_protect_tail(I, back, length) ((iof_left(I) >= (length) - (back)) ? 1 : (iof_input_save_tail(I, back) >= length - back))
201 
202 //uint8_t * iof_tail_data (iof *I, size_t *ptail);
203 //#define iof_tail_free(data) util_free(data)
204 
205 /* panic */
206 
207 // #define iof_panic(mess) return 0
208 #ifndef iof_panic
209  #define iof_panic(mess) (fputs(mess, stderr), abort())
210 #endif
211 //#define iof_memory_error() iof_panic(strerror(errno))
212 #define iof_fwrite_error() iof_panic(strerror(errno))
213 
214 /* generic helpers */
215 
216 UTILAPI uint8_t * iof_copy_file_data (const char *filename, size_t *psize);
218 
219 /* In the future we may need releasing file handle and restoring it from iofile->name, so access file handle via macros */
220 
221 #define iof_file_get_fh(iofile) ((iofile)->iofh)
222 #define iof_file_set_fh(iofile, fh) ((iofile)->iofh = fh)
223 #define iof_file_get_file(iofile) (((iofile)->flags & IOF_DATA) ? NULL : iof_file_get_fh(iofile))
224 FILE * iof_get_file (iof *F);
225 
226 /* basic iof_file interface */
227 
229 iof_file * iof_file_init (iof_file *iofile, FILE *file);
230 
231 iof_file * iof_file_rdata (const void *data, size_t size);
232 iof_file * iof_file_wdata (void *data, size_t size);
233 
234 iof_file * iof_file_rdata_init (iof_file *iofile, const void *data, size_t size);
235 iof_file * iof_file_wdata_init (iof_file *iofile, void *data, size_t size);
236 
237 iof_file * iof_file_reader_from_file_handle (iof_file *iofile, const char *filename, FILE *file, int preload, int closefile);
238 iof_file * iof_file_reader_from_file (iof_file *iofile, const char *filename, int preload);
239 iof_file * iof_file_reader_from_data (iof_file *iofile, const void *data, size_t size, int preload, int freedata);
240 //iof_file * iof_file_writer_from_file (iof_file *iofile, const char *filename);
241 
242 void * iof_copy_data (const void *data, size_t size);
243 #define iof_data_free(data) util_free(data)
244 #define iof_file_wdata_copy(data, size) iof_file_wdata(iof_copy_data(data, size), size)
245 #define iof_file_rdata_copy(data, size) iof_file_rdata(iof_copy_data(data, size), size)
246 
247 void iof_file_free (iof_file *iofile);
248 
249 #define iof_file_get_name(iofile) ((iofile)->name)
250 void iof_file_set_name (iof_file *iofile, const char *name);
251 
252 #define iof_file_incref(iofile) (++(iofile)->refcount)
253 #define iof_file_decref(iofile) ((void)(--(iofile)->refcount <= 0 && (iof_file_free(iofile), 0)))
254 
255 int iof_file_seek (iof_file *iofile, long offset, int whence);
256 long iof_file_tell (iof_file *iofile);
257 size_t iof_file_size (iof_file *iofile);
258 int iof_file_eof (iof_file *iofile);
259 
260 size_t iof_file_read (void *ptr, size_t size, size_t items, iof_file *iofile);
261 size_t iof_file_write (const void *ptr, size_t size, size_t items, iof_file *iofile);
262 size_t iof_file_ensure (iof_file *iofile, size_t bytes);
263 int iof_file_flush (iof_file *iofile);
264 
265 int iof_file_getc (iof_file *iofile);
266 int iof_file_putc (iof_file *iofile, int c);
267 
268 int iof_file_reclose_input (iof_file *iofile);
269 int iof_file_reopen_input (iof_file *iofile);
270 
271 #define iof_file_reopen(iofile) (((iofile)->flags & IOF_REOPEN_FILE) ? iof_file_reopen_input(iofile) : 1)
272 #define iof_file_reclose(iofile) (void)(((iofile)->flags & IOF_RECLOSE_FILE) ? iof_file_reclose_input(iofile) : 0)
273 
274 void iof_file_close_input (iof_file *iofile);
275 
276 /* wrappers of basic operations for iof */
277 
278 int iof_reader_seek (iof *I, long offset, int whence);
279 int iof_reader_reseek (iof *I, long offset, int whence);
280 int iof_writer_seek (iof *I, long offset, int whence);
281 int iof_writer_reseek (iof *I, long offset, int whence);
282 
283 int iof_seek (iof *I, long offset, int whence);
284 int iof_reseek (iof *I, long offset, int whence);
285 
286 long iof_reader_tell (iof *I);
287 long iof_writer_tell (iof *I);
288 long iof_tell (iof *I);
289 size_t iof_fsize (iof *I);
290 
291 #define iof_setup_iofile(I, f) (iof_file_incref(f), (I)->iofile = f, (I)->flags |= IOF_FILE)
292 #define iof_setup_file(I, fh) ((I)->file = fh, (I)->flags |= IOF_FILE_HANDLE)
293 #define iof_setup_next(I, N) ((I)->next = N, iof_incref(N), (I)->flags |= IOF_NEXT)
294 
295 /* file handler reader and writer */
296 
299 
300 /* file reader and writer */
301 
302 UTILAPI iof * iof_setup_file_reader (iof *I, void *buffer, size_t space, const char *filename);
303 UTILAPI iof * iof_setup_file_writer (iof *O, void *buffer, size_t space, const char *filename);
304 
305 /* mem writer */
306 
307 UTILAPI iof * iof_setup_buffer (iof *O, void *buffer, size_t space);
308 UTILAPI iof * iof_setup_buffermin (iof *O, void *buffer, size_t space, size_t min);
309 
311 #define iof_buffer_new() iof_buffer_create(BUFSIZ)
312 
313 /* custom handler */
314 
315 UTILAPI iof * iof_reader (iof *I, void *link, iof_handler reader, const void *s, size_t bytes);
316 UTILAPI iof * iof_writer (iof *O, void *link, iof_handler writer, void *s, size_t bytes);
317 
318 /* stdout wrapper */
319 
320 extern UTILAPI iof iof_stdout;
321 extern UTILAPI iof iof_stderr;
322 
323 /* simple string reader */
324 
325 UTILAPI iof * iof_string_reader (iof *I, const void *s, size_t bytes);
326 
327 #define iof_string(I, s, bytes) \
328  (((I)->rbuf = (I)->rpos = (const uint8_t *)s), ((I)->rend = (I)->rbuf + (bytes)), ((I)->flags |= IOF_DATA), (I))
329 
330 /* dummies */
331 
332 UTILAPI iof * iof_dummy (void *buffer, size_t space);
333 UTILAPI iof * iof_null (void *buffer, size_t space);
334 
335 /* checking available space */
336 
337 #define iof_loadable(I) ((I)->pos < (I)->end || iof_load(I))
338 #define iof_readable(I) ((I)->pos < (I)->end || iof_input(I))
339 #define iof_writable(O) ((O)->pos < (O)->end || iof_output(O))
340 
341 #define iof_hloadable iof_loadable
342 #define iof_iloadable iof_loadable
343 
344 #define iof_hreadable iof_readable
345 #define iof_ireadable iof_readable
346 
347 #define iof_hwritable iof_writable
348 #define iof_iwritable iof_writable
349 
350 /* ensure space to write several bytes (several means less then I->space) */
351 
352 #define iof_ensure(O, n) ((O)->pos+(n)-1 < (O)->end || iof_output(O)) // iof_ensure(O, 1) eq iof_writable(O)
353 #define iof_hensure(O, n) ((O)->hpos+(n)-1 < (O)->hend || iof_output(O))
354 #define iof_iensure(O, n) ((O)->ipos+(n)-1 < (O)->iend || iof_output(O))
355 
356 /* reading */
357 
358 UTILAPI int iof_getc (iof *I);
361 
362 // UTILAPI int iof_cmp (iof *I, const char *s);
363 // UTILAPI int iof_cmpn (iof *I, const char *s, size_t bytes);
364 
366 #define iof_hpass iof_pass
367 #define iof_ipass iof_pass
368 
369 /* readers helpers */
370 
371 UTILAPI size_t iof_read (iof *I, void *s, size_t bytes);
372 UTILAPI size_t iof_hread (iof *I, void *s, size_t bytes);
373 UTILAPI size_t iof_iread (iof *I, void *s, size_t bytes);
374 
375 UTILAPI size_t iof_skip (iof *I, size_t bytes);
376 UTILAPI size_t iof_hskip (iof *I, size_t bytes);
377 UTILAPI size_t iof_iskip (iof *I, size_t bytes);
378 
379 /* get */
380 
381 #define iof_pos(I) (*(I)->pos++)
382 #define iof_hpos(I) (*(I)->hpos++)
383 #define iof_ipos(I) (*(I)->ipos++)
384 
385 #define iof_get(I) (iof_readable(I) ? (int)(*(I)->pos++) : IOFEOF)
386 #define iof_hget(I) (iof_hreadable(I) ? (int)(*(I)->hpos++) : IOFEOF)
387 #define iof_iget(I) (iof_ireadable(I) ? (int)(*(I)->ipos++) : IOFEOF)
388 
389 #define iof_char(I) (iof_readable(I) ? (int)(*(I)->pos) : IOFEOF)
390 #define iof_hcurr(I) (iof_hreadable(I) ? (int)(*(I)->hpos) : IOFEOF)
391 #define iof_icurr(I) (iof_ireadable(I) ? (int)(*(I)->ipos) : IOFEOF)
392 
393 #define iof_next(I) (++(I)->pos, iof_char(I))
394 #define iof_hnext(I) (++(I)->hpos, iof_hcurr(I))
395 #define iof_inext(I) (++(I)->ipos, iof_icurr(I))
396 
397 /* unget */
398 
399 /*
400 If possible, we just move the position backward. If it is not possible to
401 move backward, we call iof_backup(I, c) that sets all pointers to the end of
402 a private backup space, then moves buf AND pos pointers backward and set c at
403 pos (==buf). We can backup characters as long as there is a private space. If
404 several calls to iof_backup() are followed by iof_get(), pos pointer
405 increases in normal way and so the use of another iof_unget() works just fine
406 by moving the position. Once we swallow all backup characters (when
407 pos==end), backup handler restores the previous pointers.
408 
409 Obviously we assume that the character provided to iof_unget() is always the
410 character just obtained from iof_get(). We CAN'T just overwrite the character
411 at a given position as the space we read may not be writable.
412 
413 When backup is in use, we can only get bytes until automatically restored.
414 */
415 
416 /* backup */
417 
418 /*
419 #define iof_uses_backup(I) ((I)->more == iof_unget_handler)
420 
421 #define iof_save(I, B) \
422  ((B)->buf = (I)->buf, (B)->pos = (I)->pos, (B)->end = (I)->end, (B)->space = (I)->space, \
423  (B)->link = I->link, (B)->more = (I)->more, (B)->flags = (I)->flags)
424 #define iof_restore(B, I) iof_save(I, B)
425 
426 #define iof_unget(I, c) \
427  ((void)(c == (uint8_t)c ? ((I)->pos > (I)->buf ? --(I)->pos : iof_backup(I, c)) : 0)
428 int iof_backup (iof *I, int c);
429 */
430 
431 /* writing */
432 
434 UTILAPI size_t iof_write_file (iof *O, const char *filename);
435 UTILAPI size_t iof_write_iofile (iof *O, iof_file *iofile, int savepos);
436 
437 UTILAPI int iof_putc (iof *O, int u);
438 UTILAPI int iof_hputc (iof *O, int u);
439 UTILAPI int iof_iputc (iof *O, int u);
440 
441 UTILAPI size_t iof_write (iof *O, const void *data, size_t size);
442 UTILAPI size_t iof_hwrite (iof *O, const void *data, size_t size);
443 UTILAPI size_t iof_iwrite (iof *O, const void *data, size_t size);
444 
445 UTILAPI iof_status iof_puts (iof *O, const void *data);
446 UTILAPI size_t iof_put_string (iof *O, const void *data);
447 UTILAPI size_t iof_putfs (iof *O, const char *format, ...);
448 UTILAPI size_t iof_repc (iof *O, char c, size_t bytes);
449 
450 #define iof_putl(O, s) iof_write(O, "" s, sizeof(s)-1)
451 //#define iof_putl iof_puts
452 
453 #define iof_set(O, c) (*(O)->pos++ = (uint8_t)(c))
454 #define iof_set2(O, c1, c2) (iof_set(O, c1), iof_set(O, c2))
455 #define iof_set3(O, c1, c2, c3) (iof_set(O, c1), iof_set(O, c2), iof_set(O, c3))
456 #define iof_set4(O, c1, c2, c3, c4) (iof_set(O, c1), iof_set(O, c2), iof_set(O, c3), iof_set(O, c4))
457 #define iof_set5(O, c1, c2, c3, c4, c5) (iof_set(O, c1), iof_set(O, c2), iof_set(O, c3), iof_set(O, c4), iof_set(O, c5))
458 
459 #define iof_hset(O, c) (*(O)->hpos++ = (uint16_t)(c))
460 #define iof_iset(O, c) (*(O)->ipos++ = (uint32_t)(c))
461 
462 #define iof_put(O, c) ((void)iof_ensure(O, 1), iof_set(O, c))
463 #define iof_put2(O, c1, c2) ((void)iof_ensure(O, 2), iof_set2(O, c1, c2))
464 #define iof_put3(O, c1, c2, c3) ((void)iof_ensure(O, 3), iof_set3(O, c1, c2, c3))
465 #define iof_put4(O, c1, c2, c3, c4) ((void)iof_ensure(O, 4), iof_set4(O, c1, c2, c3, c4))
466 #define iof_put5(O, c1, c2, c3, c4, c5) ((void)iof_ensure(O, 5), iof_set5(O, c1, c2, c3, c4, c5))
467 
468 #define iof_hput(O, c) ((void)iof_hensure(O, 1), iof_hset(O, c))
469 #define iof_iput(O, c) ((void)iof_iensure(O, 1), iof_iset(O, c))
470 
471 #define iof_put_uc_hex(O, c) iof_put2(O, base16_uc_digit1(c), base16_uc_digit2(c))
472 #define iof_put_lc_hex(O, c) iof_put2(O, base16_lc_digit1(c), base16_lc_digit2(c))
473 #define iof_set_uc_hex(O, c) iof_set2(O, base16_uc_digit1(c), base16_uc_digit2(c))
474 #define iof_set_lc_hex(O, c) iof_set2(O, base16_lc_digit1(c), base16_lc_digit2(c))
475 #define iof_put_hex iof_put_uc_hex
476 #define iof_set_hex iof_set_uc_hex
477 
478 /* number from iof; return 1 on success, 0 otherwise */
479 
480 #define iof_scan_sign(I, c, sign) _scan_sign(c, sign, iof_next(I))
481 #define iof_scan_integer(I, c, number) _scan_integer(c, number, iof_next(I))
482 #define iof_scan_radix(I, c, number, radix) _scan_radix(c, number, radix, iof_next(I))
483 #define iof_read_integer(I, c, number) _read_integer(c, number, iof_next(I))
484 #define iof_read_radix(I, c, number, radix) _read_radix(c, number, radix, iof_next(I))
485 
486 #define iof_scan_decimal(I, c, number) _scan_decimal(c, number, iof_next(I))
487 #define iof_scan_fraction(I, c, number, exponent10) _scan_fraction(c, number, exponent10, iof_next(I))
488 #define iof_scan_exponent10(I, c, exponent10) _scan_exponent10(c, exponent10, iof_next(I))
489 
491 UTILAPI int iof_get_slong (iof *I, long *number);
493 
495 UTILAPI int iof_get_ulong (iof *I, unsigned long *number);
496 UTILAPI int iof_get_usize (iof *I, size_t *number);
498 
500 UTILAPI int iof_get_slong_radix (iof *I, long *number, int radix);
502 
504 UTILAPI int iof_get_ulong_radix (iof *I, unsigned long *number, int radix);
505 UTILAPI int iof_get_usize_radix (iof *I, size_t *number, int radix);
507 
508 #if defined(INTLW_IS_INT64)
509 # define iof_get_intlw(I, number) iof_get_int64(I, number)
510 # define iof_get_uintlw(I, number) iof_get_uint64(I, number)
511 # define iof_get_intlw_radix(I, number, radix) iof_get_int64_radix(I, number, radix)
512 # define iof_get_uintlw_radix(I, number, radix) iof_get_uint64_radix(I, number, radix)
513 #elif defined(INTLW_IS_LONG)
514 # define iof_get_intlw(I, number) iof_get_slong(I, number)
515 # define iof_get_uintlw(I, number) iof_get_ulong(I, number)
516 # define iof_get_intlw_radix(I, number, radix) iof_get_slong_radix(I, number, radix)
517 # define iof_get_uintlw_radix(I, number, radix) iof_get_ulong_radix(I, number, radix)
518 #endif
519 
521 
522 UTILAPI int iof_get_double (iof *I, double *number);
523 UTILAPI int iof_get_float (iof *I, float *number);
524 
525 UTILAPI int iof_conv_double (iof *I, double *number);
526 UTILAPI int iof_conv_float (iof *I, float *number);
527 
528 /* number to iof; return a number of written bytes */
529 
531 UTILAPI size_t iof_put_slong (iof *O, long number);
533 
535 UTILAPI size_t iof_put_ulong (iof *O, unsigned long number);
536 UTILAPI size_t iof_put_usize (iof *O, size_t number);
538 
539 UTILAPI size_t iof_put_int32_radix (iof *O, int32_t number, int radix, int uc);
540 UTILAPI size_t iof_put_slong_radix (iof *O, long number, int radix, int uc);
541 UTILAPI size_t iof_put_int64_radix (iof *O, int64_t number, int radix, int uc);
542 
543 UTILAPI size_t iof_put_uint32_radix (iof *O, uint32_t number, int radix, int uc);
544 UTILAPI size_t iof_put_ulong_radix (iof *O, unsigned long number, int radix, int uc);
545 UTILAPI size_t iof_put_usize_radix (iof *O, size_t number, int radix, int uc);
546 UTILAPI size_t iof_put_uint64_radix (iof *O, uint64_t number, int radix, int uc);
547 
548 #if defined(INTLW_IS_INT64)
549 # define iof_put_intlw(O, number) iof_put_int64(O, number)
550 # define iof_put_uintlw(O, number) iof_put_uint64(O, number)
551 # define iof_put_intlw_radix(O, number, radix, uc) iof_put_int64_radix(O, number, radix, uc)
552 # define iof_put_uintlw_radix(O, number, radix, uc) iof_put_uint64_radix(O, number, radix, uc)
553 #elif defined(INTLW_IS_LONG)
554 # define iof_put_intlw(O, number) iof_put_slong(O, number)
555 # define iof_put_uintlw(O, number) iof_put_ulong(O, number)
556 # define iof_put_intlw_radix(O, number, radix, uc) iof_put_slong_radix(O, number, radix, uc)
557 # define iof_put_uintlw_radix(O, number, radix, uc) iof_put_ulong_radix(O, number, radix, uc)
558 #endif
559 
560 UTILAPI size_t iof_put_roman (iof *O, uint16_t number, int uc);
561 
562 UTILAPI size_t iof_put_double(iof *O, double number, int digits);
563 UTILAPI size_t iof_put_float(iof *O, float number, int digits);
564 
565 /* common helpers for binary parsers */
566 
567 UTILAPI int iof_get_be_uint2 (iof *I, uint32_t *pnumber);
568 UTILAPI int iof_get_be_uint3 (iof *I, uint32_t *pnumber);
569 UTILAPI int iof_get_be_uint4 (iof *I, uint32_t *pnumber);
570 
571 UTILAPI int iof_get_le_uint2 (iof *I, uint32_t *pnumber);
572 UTILAPI int iof_get_le_uint3 (iof *I, uint32_t *pnumber);
573 UTILAPI int iof_get_le_uint4 (iof *I, uint32_t *pnumber);
574 
575 // iof_set() and iof_put() suite casts arguments to uint8_t, so we don't need &0xff mask
576 
577 #define iof_set_be_uint1(O, u) iof_set(O, u)
578 #define iof_set_be_uint2(O, u) iof_set2(O, (u)>>8, u)
579 #define iof_set_be_uint3(O, u) iof_set3(O, (u)>>16, (u)>>8, u)
580 #define iof_set_be_uint4(O, u) iof_set4(O, (u)>>24, (u)>>16, (u)>>8, u)
581 
582 #define iof_set_le_uint1(O, u) iof_set(O, u)
583 #define iof_set_le_uint2(O, u) iof_set2(O, u, (u)>>8)
584 #define iof_set_le_uint3(O, u) iof_set3(O, u, (u)>>8, (u)>>16)
585 #define iof_set_le_uint4(O, u) iof_set4(O, u, (u)>>8, (u)>>16, (u)>>24)
586 
587 #define iof_put_be_uint1(O, u) iof_put(O, u)
588 #define iof_put_be_uint2(O, u) iof_put2(O, (u)>>8, u)
589 #define iof_put_be_uint3(O, u) iof_put3(O, (u)>>16, (u)>>8, u)
590 #define iof_put_be_uint4(O, u) iof_put4(O, (u)>>24, (u)>>16, (u)>>8, u)
591 
592 #define iof_put_le_uint1(O, u) iof_put(O, u)
593 #define iof_put_le_uint2(O, u) iof_put2(O, u, (u)>>8)
594 #define iof_put_le_uint3(O, u) iof_put3(O, u, (u)>>8, (u)>>16)
595 #define iof_put_le_uint4(O, u) iof_put4(O, u, (u)>>8, (u)>>16, (u)>>24)
596 
597 /* buffer results */
598 
599 #define iof_reader_result(I, size) ((size = (size_t)iof_left(I)), (I)->pos)
600 #define iof_writer_result(I, size) ((size = (size_t)iof_size(I)), (I)->buf)
601 #define iof_result(I, size) (((I)->flags & IOF_READER) ? iof_reader_result(I, size) : iof_writer_result(I, size))
602 
603 uint8_t * iof_file_input_data (iof_file *iofile, size_t *psize, int *isnew);
604 //uint8_t * iof_file_reader_data (iof_file *iofile, size_t *size);
605 //uint8_t * iof_file_writer_data (iof_file *iofile, size_t *size);
606 
607 uint8_t * iof_reader_data (iof *I, size_t *psize);
608 uint8_t * iof_writer_data (iof *O, size_t *psize);
610 size_t iof_reader_to_file (iof *I, const char *filename);
611 
612 #define iof_loaded(I) ((I)->end = (I)->pos, (I)->pos = (I)->buf, iof_left(I))
613 
614 #define iof_data_to_file_handle(data, size, file) fwrite(data, sizeof(uint8_t), size, file)
615 UTILAPI size_t iof_data_to_file (const void *data, size_t size, const char *filename);
616 
618 UTILAPI size_t iof_result_to_file (iof *F, const char *filename);
619 UTILAPI void iof_debug (iof *I, const char *filename);
620 
621 /* common filters allocator */
622 
623 void iof_filters_init (void);
624 void iof_filters_free (void);
625 
626 iof * iof_filter_reader_new (iof_handler handler, size_t statesize, void **pstate);
627 #define iof_filter_reader(handler, statesize, pstate) iof_filter_reader_new(handler, statesize, (void **)(pstate))
628 iof * iof_filter_reader_with_buffer_new (iof_handler handler, size_t statesize, void **pstate, void *buffer, size_t buffersize);
629 #define iof_filter_reader_with_buffer(handler, statesize, pstate, buffer, buffersize) iof_filter_reader_with_buffer_new(handler, statesize, (void **)(pstate), buffer, buffersize)
630 iof * iof_filter_writer_new (iof_handler handler, size_t statesize, void **pstate);
631 #define iof_filter_writer(handler, statesize, pstate) iof_filter_writer_new(handler, statesize, (void **)(pstate))
632 iof * iof_filter_writer_with_buffer_new (iof_handler handler, size_t statesize, void **pstate, void *buffer, size_t buffersize);
633 #define iof_filter_writer_with_buffer(handler, statesize, pstate, buffer, buffersize) iof_filter_writer_with_buffer_new(handler, statesize, (void **)(pstate), buffer, buffersize)
634 
635 #define iof_filter_state(statetype, F) (statetype)((void *)((F) + 1))
636 
637 void iof_free (iof *F);
638 void iof_discard (iof *F);
639 
640 size_t iof_resize_buffer_to (iof *O, size_t space);
641 #define iof_resize_buffer(O) iof_resize_buffer_to(O, (O)->space << 1)
642 
643 size_t iof_decoder_retval (iof *I, const char *type, iof_status status);
644 size_t iof_encoder_retval (iof *O, const char *type, iof_status status);
645 
646 /* filters */
647 
650 
651 iof * iof_filter_iofile_reader (iof_file *iofile, size_t offset);
652 iof * iof_filter_iofile_writer (iof_file *iofile, size_t offset);
653 
654 iof * iof_filter_file_reader (const char *filename);
655 iof * iof_filter_file_writer (const char *filename);
656 
657 iof * iof_filter_string_reader (const void *s, size_t length);
658 iof * iof_filter_string_writer (const void *s, size_t length);
659 
661 
662 iof * iof_filter_stream_reader (FILE *file, size_t offset, size_t length);
663 iof * iof_filter_stream_coreader (iof_file *iofile, size_t offset, size_t length);
664 
666 iof * iof_filter_stream_cowriter (iof_file *iofile, size_t offset);
667 
668 FILE * iof_filter_file_reader_source (iof *I, size_t *poffset, size_t *plength);
669 iof_file * iof_filter_file_coreader_source (iof *I, size_t *poffset, size_t *plength);
670 iof * iof_filter_reader_replacement (iof *P, iof_handler handler, size_t statesize, void **pstate);
671 #define iof_filter_reader_replace(P, handler, statesize, pstate) iof_filter_reader_replacement(P, handler, statesize, (void **)(pstate))
672 
673 #endif
#define type(a)
Definition: aptex-macros.h:171
#define name
#define mode
Definition: aptex-macros.h:510
static int radix
Definition: aptex.h:450
struct rect data
Definition: dvipdfm.c:64
static void
Definition: fpif.c:118
mpz_t * f
Definition: gen-fib.c:34
#define s
Definition: afcover.h:80
paragraph P
#define c(n)
Definition: gpos-common.c:150
small capitals from c petite p scientific f u
Definition: afcover.h:88
#define F(x, y, z)
Definition: md5.c:51
#define I(x, y, z)
Definition: md5.c:55
unsigned short uint16_t
Definition: stdint.h:79
signed __int64 int64_t
Definition: stdint.h:89
unsigned int uint32_t
Definition: stdint.h:80
signed int int32_t
Definition: stdint.h:77
unsigned char uint8_t
Definition: stdint.h:78
unsigned __int64 uint64_t
Definition: stdint.h:90
static GBool preload
Definition: pdftops.cc:54
#define length(c)
Definition: ctangleboot.c:65
#define size_t
Definition: glob.c:257
#define O(_t, _a, _f)
Definition: makeint.h:501
union value value
Definition: obx.h:44
unsigned digits[12]
Definition: out_routines.c:255
static int format
Definition: pbmclean.c:15
#define min(a, b)
Definition: pbmplus.h:223
char * filename[256]
Definition: pbmtopk.c:46
static int items
Definition: pgmtofs.c:86
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
static int size
Definition: ppmlabel.c:24
static int offset
Definition: ppmtogif.c:642
static long bytes
Definition: psutil.c:35
#define status
#define UTILAPI
Definition: utildecl.h:24
size_t iof_result_to_file_handle(iof *F, FILE *file)
Definition: utiliof.c:1931
int iof_get_usize(iof *I, size_t *number)
Definition: utiliof.c:1353
iof * iof_setup_file_reader(iof *I, void *buffer, size_t space, const char *filename)
Definition: utiliof.c:850
size_t iof_reader_to_file_handle(iof *I, FILE *file)
Definition: utiliof.c:1898
size_t iof_hskip(iof *I, size_t bytes)
iof iof_stdout
Definition: utiliof.c:954
void iof_debug(iof *I, const char *filename)
Definition: utiliof.c:1947
int iof_file_reopen_input(iof_file *iofile)
Definition: utiliof.c:262
size_t iof_encoder_retval(iof *O, const char *type, iof_status status)
Definition: utiliof.c:2343
iof * iof_filter_iofile_writer(iof_file *iofile, size_t offset)
Definition: utiliof.c:2592
int iof_reseek(iof *I, long offset, int whence)
Definition: utiliof.c:745
int iof_get_ulong_radix(iof *I, unsigned long *number, int radix)
Definition: utiliof.c:1408
int iof_get_uint32_radix(iof *I, uint32_t *number, int radix)
Definition: utiliof.c:1400
int iof_reader_reseek(iof *I, long offset, int whence)
Definition: utiliof.c:641
size_t iof_put_int32(iof *O, int32_t number)
Definition: utiliof.c:1605
iof_file * iof_file_rdata(const void *data, size_t size)
Definition: utiliof.c:115
iof * iof_filter_string_reader(const void *s, size_t length)
Definition: utiliof.c:2646
iof * iof_filter_buffer_writer(size_t size)
Definition: utiliof.c:2668
size_t iof_read(iof *I, void *s, size_t bytes)
Definition: utiliof.c:1122
int iof_get_ulong(iof *I, unsigned long *number)
Definition: utiliof.c:1345
size_t iof_put_int32_radix(iof *O, int32_t number, int radix, int uc)
Definition: utiliof.c:1661
size_t iof_data_to_file(const void *data, size_t size, const char *filename)
Definition: utiliof.c:1920
int iof_hputc(iof *O, int u)
void iof_filters_free(void)
Definition: utiliof.c:2037
size_t iof_write(iof *O, const void *data, size_t size)
Definition: utiliof.c:1197
int iof_get_int64_radix(iof *I, int64_t *number, int radix)
Definition: utiliof.c:1390
int iof_file_flush(iof_file *iofile)
Definition: utiliof.c:417
void iof_file_close_input(iof_file *iofile)
Definition: utiliof.c:316
int iof_get_le_uint3(iof *I, uint32_t *pnumber)
Definition: utiliof.c:1783
iof * iof_filter_stream_cowriter(iof_file *iofile, size_t offset)
Definition: utiliof.c:2914
int iof_getc(iof *I)
Definition: utiliof.c:1058
iof * iof_buffer_create(size_t space)
Definition: utiliof.c:1045
int iof_get_usize_radix(iof *I, size_t *number, int radix)
Definition: utiliof.c:1416
size_t iof_skip(iof *I, size_t bytes)
Definition: utiliof.c:1075
size_t iof_file_write(const void *ptr, size_t size, size_t items, iof_file *iofile)
Definition: utiliof.c:462
void iof_filters_init(void)
Definition: utiliof.c:2029
size_t iof_write_iofile(iof *O, iof_file *iofile, int savepos)
Definition: utiliof.c:1177
int iof_get_be_uint2(iof *I, uint32_t *pnumber)
Definition: utiliof.c:1747
size_t iof_write_file_handle(iof *O, FILE *file)
Definition: utiliof.c:1151
int iof_conv_float(iof *I, float *number)
Definition: utiliof.c:1587
void(* iof_dump_function)(const void *value, iof *O)
Definition: utiliof.h:87
iof * iof_filter_stream_coreader(iof_file *iofile, size_t offset, size_t length)
Definition: utiliof.c:2814
iof_status
Definition: utiliof.h:25
@ IOFEOF
Definition: utiliof.h:26
@ IOFFULL
Definition: utiliof.h:28
@ IOFERR
Definition: utiliof.h:29
@ IOFEMPTY
Definition: utiliof.h:27
size_t iof_put_usize_radix(iof *O, size_t number, int radix, int uc)
Definition: utiliof.c:1701
size_t iof_result_to_file(iof *F, const char *filename)
Definition: utiliof.c:1939
iof * iof_filter_file_handle_reader(FILE *file)
Definition: utiliof.c:2554
iof * iof_setup_file_handle_reader(iof *I, void *buffer, size_t space, FILE *f)
Definition: utiliof.c:842
iof * iof_filter_reader_with_buffer_new(iof_handler handler, size_t statesize, void **pstate, void *buffer, size_t buffersize)
Definition: utiliof.c:2160
iof * iof_string_reader(iof *I, const void *s, size_t bytes)
Definition: utiliof.c:977
iof_file * iof_file_wdata(void *data, size_t size)
Definition: utiliof.c:140
size_t iof_repc(iof *O, char c, size_t bytes)
Definition: utiliof.c:1262
int iof_get_le_uint4(iof *I, uint32_t *pnumber)
Definition: utiliof.c:1792
size_t iof_put_uint32_radix(iof *O, uint32_t number, int radix, int uc)
Definition: utiliof.c:1685
int iof_get_le_uint2(iof *I, uint32_t *pnumber)
Definition: utiliof.c:1774
#define IOF_MEMBERS
Definition: utiliof.h:58
iof * iof_filter_file_writer(const char *filename)
Definition: utiliof.c:2618
size_t iof_put_float(iof *O, float number, int digits)
Definition: utiliof.c:1737
size_t iof_put_uint32(iof *O, uint32_t number)
Definition: utiliof.c:1629
long iof_reader_tell(iof *I)
Definition: utiliof.c:752
iof * iof_filter_reader_new(iof_handler handler, size_t statesize, void **pstate)
Definition: utiliof.c:2141
iof * iof_reader(iof *I, void *link, iof_handler reader, const void *s, size_t bytes)
Definition: utiliof.c:961
int iof_get_float(iof *I, float *number)
Definition: utiliof.c:1549
int iof_get_double(iof *I, double *number)
Definition: utiliof.c:1527
void iof_file_free(iof_file *iofile)
Definition: utiliof.c:280
FILE * iof_filter_file_reader_source(iof *I, size_t *poffset, size_t *plength)
Definition: utiliof.c:2926
iof * iof_filter_file_handle_writer(FILE *file)
Definition: utiliof.c:2566
size_t iof_put_slong(iof *O, long number)
Definition: utiliof.c:1613
int iof_file_eof(iof_file *iofile)
Definition: utiliof.c:410
iof_file * iof_file_rdata_init(iof_file *iofile, const void *data, size_t size)
Definition: utiliof.c:128
int iof_get_slong_radix(iof *I, long *number, int radix)
Definition: utiliof.c:1380
long iof_writer_tell(iof *I)
Definition: utiliof.c:762
iof * iof_null(void *buffer, size_t space)
size_t iof_decoder_retval(iof *I, const char *type, iof_status status)
Definition: utiliof.c:2322
iof_file * iof_file_reader_from_file_handle(iof_file *iofile, const char *filename, FILE *file, int preload, int closefile)
Definition: utiliof.c:152
size_t iof_fsize(iof *I)
Definition: utiliof.c:777
iof * iof_filter_writer_with_buffer_new(iof_handler handler, size_t statesize, void **pstate, void *buffer, size_t buffersize)
Definition: utiliof.c:2194
FILE * iof_get_file(iof *F)
Definition: utiliof.c:61
void iof_file_set_name(iof_file *iofile, const char *name)
Definition: utiliof.c:344
uint8_t * iof_reader_data(iof *I, size_t *psize)
Definition: utiliof.c:1859
int iof_get_roman(iof *I, uint16_t *number)
Definition: utiliof.c:1451
size_t iof_put_double(iof *O, double number, int digits)
Definition: utiliof.c:1729
int iof_file_reclose_input(iof_file *iofile)
Definition: utiliof.c:248
size_t iof_reader_to_file(iof *I, const char *filename)
Definition: utiliof.c:1906
size_t iof_resize_buffer_to(iof *O, size_t space)
Definition: utiliof.c:2293
int iof_igetc(iof *I)
iof * iof_setup_buffer(iof *O, void *buffer, size_t space)
Definition: utiliof.c:1024
iof_file * iof_file_reader_from_file(iof_file *iofile, const char *filename, int preload)
Definition: utiliof.c:187
iof * iof_filter_string_writer(const void *s, size_t length)
Definition: utiliof.c:2657
int iof_get_uint64(iof *I, uint64_t *number)
Definition: utiliof.c:1361
iof_mode
Definition: utiliof.h:15
@ IOFCLOSE
Definition: utiliof.h:20
@ IOFREAD
Definition: utiliof.h:16
@ IOFLOAD
Definition: utiliof.h:17
@ IOFFLUSH
Definition: utiliof.h:19
@ IOFWRITE
Definition: utiliof.h:18
void * iof_copy_data(const void *data, size_t size)
Definition: utiliof.c:18
size_t iof_write_file(iof *O, const char *filename)
Definition: utiliof.c:1166
int iof_get_uint32(iof *I, uint32_t *number)
Definition: utiliof.c:1337
int iof_file_getc(iof_file *iofile)
Definition: utiliof.c:502
size_t iof_save_tail(iof *I)
Definition: utiliof.c:796
int iof_get_slong(iof *I, long *number)
Definition: utiliof.c:1317
iof * iof_setup_file_writer(iof *O, void *buffer, size_t space, const char *filename)
Definition: utiliof.c:891
long iof_file_tell(iof_file *iofile)
Definition: utiliof.c:391
size_t iof_put_uint64_radix(iof *O, uint64_t number, int radix, int uc)
Definition: utiliof.c:1709
uint8_t * iof_copy_file_handle_data(FILE *file, size_t *psize)
Definition: utiliof.c:43
iof * iof_filter_stream_writer(FILE *file)
Definition: utiliof.c:2904
iof_file * iof_file_wdata_init(iof_file *iofile, void *data, size_t size)
Definition: utiliof.c:145
size_t iof_putfs(iof *O, const char *format,...)
Definition: utiliof.c:1288
size_t iof_file_read(void *ptr, size_t size, size_t items, iof_file *iofile)
Definition: utiliof.c:424
size_t iof_put_string(iof *O, const void *data)
Definition: utiliof.c:1238
size_t iof_hread(iof *I, void *s, size_t bytes)
void iof_discard(iof *F)
Definition: utiliof.c:2276
int iof_reader_seek(iof *I, long offset, int whence)
Definition: utiliof.c:629
size_t iof_file_size(iof_file *iofile)
Definition: utiliof.c:396
iof * iof_filter_iofile_reader(iof_file *iofile, size_t offset)
Definition: utiliof.c:2580
size_t iof_put_ulong(iof *O, unsigned long number)
Definition: utiliof.c:1637
size_t iof_put_usize(iof *O, size_t number)
Definition: utiliof.c:1645
int iof_get_be_uint3(iof *I, uint32_t *pnumber)
Definition: utiliof.c:1756
long iof_tell(iof *I)
Definition: utiliof.c:772
size_t iof_put_int64_radix(iof *O, int64_t number, int radix, int uc)
Definition: utiliof.c:1677
iof_status iof_puts(iof *O, const void *data)
Definition: utiliof.c:1225
size_t iof_put_uint64(iof *O, uint64_t number)
Definition: utiliof.c:1653
size_t iof_hwrite(iof *O, const void *data, size_t size)
size_t iof_iread(iof *I, void *s, size_t bytes)
int iof_writer_seek(iof *I, long offset, int whence)
Definition: utiliof.c:716
uint8_t * iof_file_input_data(iof_file *iofile, size_t *psize, int *isnew)
Definition: utiliof.c:1803
int iof_get_uint64_radix(iof *I, uint64_t *number, int radix)
Definition: utiliof.c:1424
int iof_writer_reseek(iof *I, long offset, int whence)
Definition: utiliof.c:728
size_t iof_iwrite(iof *O, const void *data, size_t size)
uint8_t * iof_copy_file_data(const char *filename, size_t *psize)
Definition: utiliof.c:23
void iof_free(iof *F)
Definition: utiliof.c:2261
int iof_file_putc(iof_file *iofile, int c)
Definition: utiliof.c:509
iof * iof_setup_file_handle_writer(iof *O, void *buffer, size_t space, FILE *f)
Definition: utiliof.c:883
iof * iof_writer(iof *O, void *link, iof_handler writer, void *s, size_t bytes)
Definition: utiliof.c:991
size_t iof_put_roman(iof *O, uint16_t number, int uc)
Definition: utiliof.c:1719
iof * iof_dummy(void *buffer, size_t space)
int iof_file_seek(iof_file *iofile, long offset, int whence)
Definition: utiliof.c:356
int iof_iputc(iof *O, int u)
size_t iof_iskip(iof *I, size_t bytes)
iof_status iof_pass(iof *I, iof *O)
Definition: utiliof.c:1090
size_t iof_put_int64(iof *O, int64_t number)
Definition: utiliof.c:1621
size_t iof_put_slong_radix(iof *O, long number, int radix, int uc)
Definition: utiliof.c:1669
iof * iof_filter_writer_new(iof_handler handler, size_t statesize, void **pstate)
Definition: utiliof.c:2175
size_t(* iof_handler)(iof *I, iof_mode mode)
Definition: utiliof.h:54
int iof_conv_double(iof *I, double *number)
Definition: utiliof.c:1571
iof * iof_filter_reader_replacement(iof *P, iof_handler handler, size_t statesize, void **pstate)
Definition: utiliof.c:2966
int iof_putc(iof *O, int u)
Definition: utiliof.c:1065
size_t iof_input_save_tail(iof *I, size_t back)
Definition: utiliof.c:808
iof_file * iof_file_init(iof_file *iofile, FILE *file)
Definition: utiliof.c:104
int iof_get_int32_radix(iof *I, int32_t *number, int radix)
Definition: utiliof.c:1369
iof_file * iof_file_reader_from_data(iof_file *iofile, const void *data, size_t size, int preload, int freedata)
Definition: utiliof.c:195
iof * iof_setup_buffermin(iof *O, void *buffer, size_t space, size_t min)
Definition: utiliof.c:1033
size_t iof_file_ensure(iof_file *iofile, size_t bytes)
Definition: utiliof.c:484
const char * iof_status_kind(iof_status status)
Definition: utiliof.c:70
iof_file * iof_filter_file_coreader_source(iof *I, size_t *poffset, size_t *plength)
Definition: utiliof.c:2946
int iof_get_be_uint4(iof *I, uint32_t *pnumber)
Definition: utiliof.c:1765
uint8_t * iof_writer_data(iof *O, size_t *psize)
Definition: utiliof.c:1879
int iof_get_int32(iof *I, int32_t *number)
Definition: utiliof.c:1307
int iof_get_int64(iof *I, int64_t *number)
Definition: utiliof.c:1327
iof * iof_filter_stream_reader(FILE *file, size_t offset, size_t length)
Definition: utiliof.c:2803
iof_file * iof_file_new(FILE *file)
Definition: utiliof.c:92
iof * iof_filter_file_reader(const char *filename)
Definition: utiliof.c:2604
iof iof_stderr
Definition: utiliof.c:957
size_t iof_put_ulong_radix(iof *O, unsigned long number, int radix, int uc)
Definition: utiliof.c:1693
int iof_hgetc(iof *I)
struct iof_file iof_file
int iof_seek(iof *I, long offset, int whence)
Definition: utiliof.c:740
static int writer(lua_State *L, const void *b, size_t size, void *B)
Definition: lstrlib.c:182
static const char * reader(lua_State *L, void *ud, size_t *size)
Definition: luac.c:122
Definition: utils.c:300
Definition: filedef.h:30
size_t * offset
Definition: utiliof.h:44
const uint8_t * rend
Definition: utiliof.h:41
uint8_t * pos
Definition: utiliof.h:40
int flags
Definition: utiliof.h:48
const uint8_t * rpos
Definition: utiliof.h:41
const uint8_t * rbuf
Definition: utiliof.h:41
FILE * iofh
Definition: utiliof.h:38
size_t size
Definition: utiliof.h:46
uint8_t * buf
Definition: utiliof.h:40
int refcount
Definition: utiliof.h:47
uint8_t * end
Definition: utiliof.h:40
char * name
Definition: utiliof.h:45
Definition: utiliof.h:83
#define FILE
Definition: t1stdio.h:34
back
Definition: tex4ht.c:3533