Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: third_party/lua/src/lzio.h

Issue 14907017: add SkLuaCanvas (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/lua/src/lvm.c ('k') | third_party/lua/src/lzio.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 ** $Id: lzio.h,v 1.26 2011/07/15 12:48:03 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_resetbuffer(buff) ((buff)->n = 0)
36
37
38 #define luaZ_resizebuffer(L, buff, size) \
39 (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \
40 (buff)->buffsize = size)
41
42 #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
43
44
45 LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);
46 LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,
47 void *data);
48 LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */
49
50
51
52 /* --------- Private Part ------------------ */
53
54 struct Zio {
55 size_t n; /* bytes still unread */
56 const char *p; /* current position in buffer */
57 lua_Reader reader; /* reader function */
58 void* data; /* additional data */
59 lua_State *L; /* Lua state (for reader) */
60 };
61
62
63 LUAI_FUNC int luaZ_fill (ZIO *z);
64
65 #endif
OLDNEW
« no previous file with comments | « third_party/lua/src/lvm.c ('k') | third_party/lua/src/lzio.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698