annotate lib/lua/lua-5.2.2/lzio.h @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents 41cc4dd3c122
children
rev   line source
1866
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
1 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
2 ** $Id: lzio.h,v 1.26 2011/07/15 12:48:03 roberto Exp $
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
3 ** Buffered streams
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
4 ** See Copyright Notice in lua.h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
5 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
7
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
8 #ifndef lzio_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
9 #define lzio_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
10
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
11 #include "lua.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
12
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
13 #include "lmem.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
14
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
15
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
16 #define EOZ (-1) /* end of stream */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
17
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
18 typedef struct Zio ZIO;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
19
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
20 #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
21
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
22
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
23 typedef struct Mbuffer {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
24 char *buffer;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
25 size_t n;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
26 size_t buffsize;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
27 } Mbuffer;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
28
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
29 #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
30
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
31 #define luaZ_buffer(buff) ((buff)->buffer)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
32 #define luaZ_sizebuffer(buff) ((buff)->buffsize)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
33 #define luaZ_bufflen(buff) ((buff)->n)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
34
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
35 #define luaZ_resetbuffer(buff) ((buff)->n = 0)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
36
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
37
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
38 #define luaZ_resizebuffer(L, buff, size) \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
39 (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
40 (buff)->buffsize = size)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
41
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
42 #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
43
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
44
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
45 LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
46 LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
47 void *data);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
48 LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
49
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
50
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
51
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
52 /* --------- Private Part ------------------ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
53
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
54 struct Zio {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
55 size_t n; /* bytes still unread */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
56 const char *p; /* current position in buffer */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
57 lua_Reader reader; /* reader function */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
58 void* data; /* additional data */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
59 lua_State *L; /* Lua state (for reader) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
60 };
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
61
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
62
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
63 LUAI_FUNC int luaZ_fill (ZIO *z);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
64
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
65 #endif