aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-11 11:44:38 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-11 11:44:38 -0300
commit70c8a310925d6c41c3ef4f7feeae604a4c9a3a95 (patch)
tree47f19fecb2ea158c4a53031a90f6abe6dfb939ce
parent2018380e9f47e8e59c3f84964591c4fb7727f8c0 (diff)
downloadlua-70c8a310925d6c41c3ef4f7feeae604a4c9a3a95.tar.gz
lua-70c8a310925d6c41c3ef4f7feeae604a4c9a3a95.tar.bz2
lua-70c8a310925d6c41c3ef4f7feeae604a4c9a3a95.zip
obsolete module
-rw-r--r--lbuffer.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/lbuffer.c b/lbuffer.c
deleted file mode 100644
index 7e0ecdbf..00000000
--- a/lbuffer.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2** $Id: lbuffer.c,v 1.14 2000/06/12 13:52:05 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h
5*/
6
7
8#include <stdio.h>
9
10#include "lua.h"
11
12#include "lauxlib.h"
13#include "lmem.h"
14#include "lstate.h"
15
16
17/*-------------------------------------------------------
18** Auxiliary buffer
19-------------------------------------------------------*/
20
21
22/*
23** amount of extra space (pre)allocated when buffer is reallocated
24*/
25#define EXTRABUFF 32
26
27
28#define openspace(L, size) if ((size_t)(size) > L->Mbuffsize-L->Mbuffnext) \
29 Openspace(L, size)
30
31static void Openspace (lua_State *L, size_t size) {
32 lint32 newsize = ((lint32)L->Mbuffnext+size+EXTRABUFF)*2;
33 luaM_reallocvector(L, L->Mbuffer, newsize, char);
34 L->Mbuffsize = newsize;
35}
36
37
38char *luaL_openspace (lua_State *L, size_t size) {
39 openspace(L, size);
40 return L->Mbuffer+L->Mbuffnext;
41}
42
43
44void luaL_addchar (lua_State *L, int c) {
45 openspace(L, 1);
46 L->Mbuffer[L->Mbuffnext++] = (char)c;
47}
48
49
50void luaL_resetbuffer (lua_State *L) {
51 L->Mbuffnext = L->Mbuffbase;
52}
53
54
55void luaL_addsize (lua_State *L, size_t n) {
56 L->Mbuffnext += n;
57}
58
59size_t luaL_getsize (lua_State *L) {
60 return L->Mbuffnext-L->Mbuffbase;
61}
62
63size_t luaL_newbuffer (lua_State *L, size_t size) {
64 size_t old = L->Mbuffbase;
65 openspace(L, size);
66 L->Mbuffbase = L->Mbuffnext;
67 return old;
68}
69
70
71void luaL_oldbuffer (lua_State *L, size_t old) {
72 L->Mbuffnext = L->Mbuffbase;
73 L->Mbuffbase = old;
74}
75
76
77char *luaL_buffer (lua_State *L) {
78 return L->Mbuffer+L->Mbuffbase;
79}
80