| [aad342c] | 1 | #ifdef __cplusplus
|
|---|
| 2 | extern "C" {
|
|---|
| 3 | #endif
|
|---|
| 4 |
|
|---|
| 5 | #ifndef GD_IO_H
|
|---|
| 6 | #define GD_IO_H 1
|
|---|
| 7 |
|
|---|
| 8 | #include <stdio.h>
|
|---|
| 9 |
|
|---|
| 10 | #ifdef VMS
|
|---|
| 11 | # define Putchar gdPutchar
|
|---|
| 12 | #endif
|
|---|
| 13 |
|
|---|
| 14 | typedef struct gdIOCtx {
|
|---|
| 15 | int (*getC)(struct gdIOCtx *);
|
|---|
| 16 | int (*getBuf)(struct gdIOCtx *, void *, int);
|
|---|
| 17 | void (*putC)(struct gdIOCtx *, int);
|
|---|
| 18 | int (*putBuf)(struct gdIOCtx *, const void *, int);
|
|---|
| 19 | /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
|
|---|
| 20 | int (*seek)(struct gdIOCtx *, const int);
|
|---|
| 21 | long (*tell)(struct gdIOCtx *);
|
|---|
| 22 | void (*gd_free)(struct gdIOCtx *);
|
|---|
| 23 | void *data;
|
|---|
| 24 | }
|
|---|
| 25 | gdIOCtx;
|
|---|
| 26 |
|
|---|
| 27 | typedef struct gdIOCtx *gdIOCtxPtr;
|
|---|
| 28 |
|
|---|
| 29 | void Putword(int w, gdIOCtx *ctx);
|
|---|
| 30 | void Putchar(int c, gdIOCtx *ctx);
|
|---|
| 31 |
|
|---|
| 32 | void gdPutC(const unsigned char c, gdIOCtx *ctx);
|
|---|
| 33 | int gdPutBuf(const void *, int, gdIOCtx *);
|
|---|
| 34 | void gdPutWord(int w, gdIOCtx *ctx);
|
|---|
| 35 | void gdPutInt(int w, gdIOCtx *ctx);
|
|---|
| 36 |
|
|---|
| 37 | int gdGetC(gdIOCtx *ctx);
|
|---|
| 38 | int gdGetBuf(void *, int, gdIOCtx *);
|
|---|
| 39 | int gdGetByte(int *result, gdIOCtx *ctx);
|
|---|
| 40 | int gdGetWord(int *result, gdIOCtx *ctx);
|
|---|
| 41 | int gdGetWordLSB(signed short int *result, gdIOCtx *ctx);
|
|---|
| 42 | int gdGetInt(int *result, gdIOCtx *ctx);
|
|---|
| 43 | int gdGetIntLSB(signed int *result, gdIOCtx *ctx);
|
|---|
| 44 |
|
|---|
| 45 | int gdSeek(gdIOCtx *ctx, const int offset);
|
|---|
| 46 | long gdTell(gdIOCtx *ctx);
|
|---|
| 47 |
|
|---|
| 48 | #endif
|
|---|
| 49 |
|
|---|
| 50 | #ifdef __cplusplus
|
|---|
| 51 | }
|
|---|
| 52 | #endif
|
|---|