/usr/include/c-lib/inc/gen-buf.h is in libesnacc-dev 1.8.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /*
* gen_buf.h - flexible (runtime configurable) buffer mgmt stuff.
*
* These are somewhat slower than the direct approach used in
* the compiled stuff. Since tables are around 4x slower,
* the flexibility of the GenBufs can be justified. This
* also allows one enc/dec library to support all buffer types.
*
* MS 93
*
* Copyright (C) 1993 Michael Sample
* and the University of British Columbia
*
* This library is free software; you can redistribute it and/or
* modify it provided that this copyright/license information is retained
* in original form.
*
* If you modify this file, you must clearly indicate your changes.
*
* This source code is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef _gen_buf_h_
#define _gen_buf_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
* These are the standard buffer routines that the lib
* routines need. Note that the Peek routines have be
* added to the standard list - they are necessary
* to nicely support the table oriented decoder.
* The "void *b" param's real type will be the buffer
* type that is used inside the GenBuf
* (ie ExpBuf ** have been defined).
*
* Note that macros can not be used for these standard functions
* because the GenBuf keeps a pointer to these routines.
* Thus the exp_buf.[ch] and files are somewhat
* differnt than those in snacc/c_lib and snacc/c_include
*
*/
typedef int (*BufCopyAnyFcn) PROTO ((void *b, void *value, unsigned long *bytesDecoded, ENV_TYPE env));
typedef unsigned char (*BufGetByteFcn) PROTO ((void *b));
typedef unsigned char *(*BufGetSegFcn) PROTO ((void *b, unsigned long *lenPtr));
typedef long (*BufCopyFcn) PROTO ((char *dst, void *b, unsigned long len));
typedef void (*BufSkipFcn) PROTO ((void *b, unsigned long len));
typedef unsigned char (*BufPeekByteFcn) PROTO ((void *b));
typedef unsigned char *(*BufPeekSegFcn) PROTO ((void *b, unsigned long *lenPtr));
typedef long (*BufPeekCopyFcn) PROTO ((char *dst, void *b, unsigned long len));
typedef void (*BufPutByteRvsFcn) PROTO ((void *b, unsigned char byte));
typedef void (*BufPutSegRvsFcn) PROTO ((void *b, char *data, unsigned long len));
typedef int (*BufReadErrorFcn) PROTO ((void *b));
typedef int (*BufWriteErrorFcn) PROTO ((void *b));
typedef int (*BufSetWriteErrorFcn) PROTO ((void *b, unsigned short Value));
typedef void (*BufResetInReadModeFcn) PROTO ((void *b));
typedef struct GenBuf
{
BufCopyAnyFcn copyAny;
BufGetByteFcn getByte;
BufGetSegFcn getSeg;
BufCopyFcn copy;
BufSkipFcn skip;
BufPeekByteFcn peekByte;
BufPeekSegFcn peekSeg;
BufPeekCopyFcn peekCopy;
BufPutByteRvsFcn putByteRvs;
BufPutSegRvsFcn putSegRvs;
BufReadErrorFcn readError;
BufSetWriteErrorFcn setWriteError;
BufWriteErrorFcn writeError;
BufResetInReadModeFcn resetInReadMode;
void *bufInfo;
void *spare; /* hack to save space for ExpBuf ** type */
} GenBuf;
static inline
int
GenBufCopyAny(GenBuf *b, void *value, unsigned long *bytesDecoded,
ENV_TYPE env)
{
return b->copyAny(b->bufInfo, value, bytesDecoded, env);
}
static inline
unsigned char
GenBufGetByte(GenBuf *b)
{
return b->getByte(b->bufInfo);
}
static inline
unsigned char *
GenBufGetSeg(GenBuf *b, unsigned long *lenPtr)
{
return b->getSeg(b->bufInfo, lenPtr);
}
static inline
long
GenBufCopy(char *dst, GenBuf *b, unsigned long len)
{
return b->copy(dst, b->bufInfo, len);
}
static inline
void
GenBufSkip(GenBuf *b, unsigned long len)
{
b->skip(b->bufInfo, len);
}
static inline
unsigned char
GenBufPeekByte(GenBuf *b)
{
return b->peekByte(b->bufInfo);
}
static inline
unsigned char *
GenBufPeekSeg(GenBuf *b, unsigned long *lenPtr)
{
return b->peekSeg(b->bufInfo, lenPtr);
}
static inline
long
GenBufPeekCopy(char *dst, GenBuf *b, unsigned long len)
{
return b->peekCopy(dst, b->bufInfo, len);
}
static inline
void
GenBufPutByteRvs(GenBuf *b, unsigned char byte)
{
b->putByteRvs(b->bufInfo, byte);
}
static inline
void
GenBufPutSegRvs(GenBuf *b, char *data, unsigned long len)
{
b->putSegRvs(b->bufInfo, data, len);
}
static inline
int
GenBufReadError(GenBuf *b)
{
return b->readError(b->bufInfo);
}
static inline
int
GenBufWriteError(GenBuf *b)
{
return b->writeError(b->bufInfo);
}
static inline
int
GenBufSetWriteError(GenBuf *b, unsigned short value)
{
return b->setWriteError(b->bufInfo, value);
}
static inline
void
GenBufResetInReadMode(GenBuf *b)
{
b->resetInReadMode(b->bufInfo);
}
#define GenBufFree(b) free(b)
#ifdef __cplusplus
}
#endif
#endif /* _gen_buf_h_ conditional include */
|