~ubuntu-branches/debian/squeeze/freeciv/squeeze

« back to all changes in this revision

Viewing changes to dependencies/lua/src/lzio.h

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2010-02-23 22:09:02 UTC
  • mfrom: (1.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20100223220902-kiyrmr9i4152cka5
Tags: 2.2.0-1
[ Karl Goetz ]
* Remove civserver files in /etc/ggzd/ (Closes: 523772, 517787)
* Adding ${misc:Depends} to all binary packages (lintian warnings)

[ Clint Adams ]
* New upstream version.
  - Drop data_dsc_use_bindir.diff (binary pathnames have changed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
** $Id: lzio.h 10334 2005-04-26 22:08:24Z vas $
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
 
 
14
 
#define EOZ     (-1)                    /* end of stream */
15
 
 
16
 
typedef struct Zio ZIO;
17
 
 
18
 
 
19
 
#define char2int(c)     cast(int, cast(unsigned char, (c)))
20
 
 
21
 
#define zgetc(z)  (((z)->n--)>0 ?  char2int(*(z)->p++) : luaZ_fill(z))
22
 
 
23
 
#define zname(z)        ((z)->name)
24
 
 
25
 
void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name);
26
 
size_t luaZ_read (ZIO* z, void* b, size_t n);   /* read next n bytes */
27
 
int luaZ_lookahead (ZIO *z);
28
 
 
29
 
 
30
 
 
31
 
typedef struct Mbuffer {
32
 
  char *buffer;
33
 
  size_t buffsize;
34
 
} Mbuffer;
35
 
 
36
 
 
37
 
char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);
38
 
 
39
 
#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
40
 
 
41
 
#define luaZ_sizebuffer(buff)   ((buff)->buffsize)
42
 
#define luaZ_buffer(buff)       ((buff)->buffer)
43
 
 
44
 
#define luaZ_resizebuffer(L, buff, size) \
45
 
        (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \
46
 
        (buff)->buffsize = size)
47
 
 
48
 
#define luaZ_freebuffer(L, buff)        luaZ_resizebuffer(L, buff, 0)
49
 
 
50
 
 
51
 
/* --------- Private Part ------------------ */
52
 
 
53
 
struct Zio {
54
 
  size_t n;                     /* bytes still unread */
55
 
  const char *p;                /* current position in buffer */
56
 
  lua_Chunkreader reader;
57
 
  void* data;                   /* additional data */
58
 
  const char *name;
59
 
};
60
 
 
61
 
 
62
 
int luaZ_fill (ZIO *z);
63
 
 
64
 
#endif