RetroArch
lzio.h
Go to the documentation of this file.
1 /*
2 ** $Id: lzio.h,v 1.31.1.1 2017/04/19 17:20:42 roberto Exp $
3 ** Buffered streams
4 ** See Copyright Notice in lua.h
5 */
6 
7 
8 #ifndef lzio_h
9 #define lzio_h
10 
11 #include "lua.h"
12 
13 #include "lmem.h"
14 
15 
16 #define EOZ (-1) /* end of stream */
17 
18 typedef struct Zio ZIO;
19 
20 #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z))
21 
22 
23 typedef struct Mbuffer {
24  char *buffer;
25  size_t n;
26  size_t buffsize;
27 } Mbuffer;
28 
29 #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
30 
31 #define luaZ_buffer(buff) ((buff)->buffer)
32 #define luaZ_sizebuffer(buff) ((buff)->buffsize)
33 #define luaZ_bufflen(buff) ((buff)->n)
34 
35 #define luaZ_buffremove(buff,i) ((buff)->n -= (i))
36 #define luaZ_resetbuffer(buff) ((buff)->n = 0)
37 
38 
39 #define luaZ_resizebuffer(L, buff, size) \
40  ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \
41  (buff)->buffsize, size), \
42  (buff)->buffsize = size)
43 
44 #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
45 
46 
48  void *data);
49 LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */
50 
51 
52 
53 /* --------- Private Part ------------------ */
54 
55 struct Zio {
56  size_t n; /* bytes still unread */
57  const char *p; /* current position in buffer */
58  lua_Reader reader; /* reader function */
59  void *data; /* additional data */
60  lua_State *L; /* Lua state (for reader) */
61 };
62 
63 
64 LUAI_FUNC int luaZ_fill (ZIO *z);
65 
66 #endif
const char *(* lua_Reader)(lua_State *L, void *ud, size_t *sz)
Definition: lua.h:116
size_t n
Definition: lzio.h:25
Definition: lzio.h:23
static const char * reader(lua_State *L, void *ud, size_t *size)
Definition: luac.c:122
GLdouble GLdouble z
Definition: glext.h:6514
char * buffer
Definition: lzio.h:24
Definition: ibxm.h:9
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define LUAI_FUNC
Definition: luaconf.h:282
struct Mbuffer Mbuffer
lua_Reader reader
Definition: lzio.h:58
const char * p
Definition: lzio.h:57
LUAI_FUNC void luaZ_init(lua_State *L, ZIO *z, lua_Reader reader, void *data)
Definition: lzio.c:38
LUAI_FUNC int luaZ_fill(ZIO *z)
Definition: lzio.c:23
void * data
Definition: lzio.h:59
size_t n
Definition: lzio.h:56
Ιστορικό Εικόνα Πληροφορίες Όλοι Οι Χρήστες Χειρίζονται Το Μενού Αριστερό Αναλογικό Αριστερό Αναλογικό Αριστερό Αναλογικό Y Αριστερό Αναλογικό Δεξί Αναλογικό X Δεξί Αναλογικό Δεξί Αναλογικό Y Δεξί Αναλογικό Σκανδάλη Όπλου Όπλο Aux A Όπλο Aux C Όπλο Select Όπλο D pad Κάτω Όπλο D pad Δεξιά Νεκρή Ζώνη Αναλογικού Σύνδεση Όλων Λήξη Χρόνου Σύνδεσης Hide Unbound Core Input Descriptors Κατάλογος Συσκευών Κατάλογος Ποντικιού Duty Cycle Keyboard Gamepad Mapping Enable Κουμπί D pad κάτω Κουμπί Κουμπί L(πίσω)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_LEFT
size_t buffsize
Definition: lzio.h:26
LUAI_FUNC size_t luaZ_read(ZIO *z, void *b, size_t n)
Definition: lzio.c:48
Definition: lstate.h:178
GLdouble n
Definition: glext.h:8396
Definition: lzio.h:55
lua_State * L
Definition: lzio.h:60