sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
lzio.h
Go to the documentation of this file.
1
/*
2
** $Id: lzio.h $
3
** Buffered streams
4
** See Copyright Notice in lua.h
5
*/
6
7
12
#ifndef lzio_h
13
#define lzio_h
14
15
#include "
lua.h
"
16
17
#include "
lmem.h
"
18
19
20
#define EOZ (-1)
/* end of stream */
21
22
typedef
struct
Zio
ZIO;
23
24
#define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z))
25
26
27
typedef
struct
Mbuffer
{
28
char
*buffer;
29
size_t
n;
30
size_t
buffsize;
31
}
Mbuffer
;
32
33
#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
34
35
#define luaZ_buffer(buff) ((buff)->buffer)
36
#define luaZ_sizebuffer(buff) ((buff)->buffsize)
37
#define luaZ_bufflen(buff) ((buff)->n)
38
39
#define luaZ_buffremove(buff,i) ((buff)->n -= (i))
40
#define luaZ_resetbuffer(buff) ((buff)->n = 0)
41
42
43
#define luaZ_resizebuffer(L, buff, size) \
44
((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \
45
(buff)->buffsize, size), \
46
(buff)->buffsize = size)
47
48
#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
49
50
51
LUAI_FUNC
void
luaZ_init (
lua_State
*L, ZIO *z, lua_Reader reader,
52
void
*data);
53
LUAI_FUNC
size_t
luaZ_read (ZIO* z,
void
*b,
size_t
n);
/* read next n bytes */
54
55
56
57
/* --------- Private Part ------------------ */
58
59
struct
Zio
{
60
size_t
n;
/* bytes still unread */
61
const
char
*p;
/* current position in buffer */
62
lua_Reader reader;
/* reader function */
63
void
*data;
/* additional data */
64
lua_State
*L;
/* Lua state (for reader) */
65
};
66
67
68
LUAI_FUNC
int
luaZ_fill (ZIO *z);
69
70
#endif
lmem.h
lua.h
Mbuffer
Definition
lzio.h:27
Zio
Definition
lzio.h:59
lua_State
Definition
lstate.h:313
lua
src
lzio.h
Generated by
1.18.0