summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-01-09 12:57:43 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-01-09 12:57:43 -0200
commit6ac047afc46cbee935587b5734ec37d2e667a598 (patch)
tree9dd53dcde6b44b1b2593420a13cbd828261a690e
parent0e1058cfdd07a3751fce1c79b75241cf770266cf (diff)
downloadlua-6ac047afc46cbee935587b5734ec37d2e667a598.tar.gz
lua-6ac047afc46cbee935587b5734ec37d2e667a598.tar.bz2
lua-6ac047afc46cbee935587b5734ec37d2e667a598.zip
details
-rw-r--r--llex.h4
-rw-r--r--lobject.h13
-rw-r--r--lstate.h6
-rw-r--r--lstrlib.c4
-rw-r--r--lzio.h4
-rw-r--r--manual.tex26
6 files changed, 27 insertions, 30 deletions
diff --git a/llex.h b/llex.h
index 7ebfa378..dcce5149 100644
--- a/llex.h
+++ b/llex.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.h,v 1.5 1997/12/02 12:43:44 roberto Exp roberto $ 2** $Id: llex.h,v 1.6 1997/12/17 20:48:58 roberto Exp roberto $
3** Lexical Analizer 3** Lexical Analizer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -28,8 +28,8 @@ typedef struct LexState {
28 int linenumber; /* input line counter */ 28 int linenumber; /* input line counter */
29 int linelasttoken; /* line where last token was read */ 29 int linelasttoken; /* line where last token was read */
30 int lastline; /* last line wherein a SETLINE was generated */ 30 int lastline; /* last line wherein a SETLINE was generated */
31 struct ifState ifstate[MAX_IFS];
32 int iflevel; /* level of nested $if's (for lexical analysis) */ 31 int iflevel; /* level of nested $if's (for lexical analysis) */
32 struct ifState ifstate[MAX_IFS];
33} LexState; 33} LexState;
34 34
35 35
diff --git a/lobject.h b/lobject.h
index 366b1802..6fc61916 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.12 1997/12/23 19:24:19 roberto Exp roberto $ 2** $Id: lobject.h,v 1.13 1997/12/26 18:38:16 roberto Exp roberto $
3** Type definitions for Lua objects 3** Type definitions for Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -96,8 +96,8 @@ typedef struct TaggedString {
96 union { 96 union {
97 TObject globalval; 97 TObject globalval;
98 struct { 98 struct {
99 void *v; /* if this is a userdata, here is its value */
100 int tag; 99 int tag;
100 void *v; /* if this is a userdata, here is its value */
101 } d; 101 } d;
102 } u; 102 } u;
103 char str[1]; /* \0 byte already reserved */ 103 char str[1]; /* \0 byte already reserved */
@@ -111,11 +111,11 @@ typedef struct TaggedString {
111*/ 111*/
112typedef struct TProtoFunc { 112typedef struct TProtoFunc {
113 GCnode head; 113 GCnode head;
114 struct TObject *consts;
115 int nconsts;
114 Byte *code; /* ends with opcode ENDCODE */ 116 Byte *code; /* ends with opcode ENDCODE */
115 int lineDefined; 117 int lineDefined;
116 TaggedString *fileName; 118 TaggedString *fileName;
117 struct TObject *consts;
118 int nconsts;
119 struct LocVar *locvars; /* ends with line = -1 */ 119 struct LocVar *locvars; /* ends with line = -1 */
120} TProtoFunc; 120} TProtoFunc;
121 121
@@ -166,11 +166,6 @@ typedef struct Hash {
166} Hash; 166} Hash;
167 167
168 168
169/*
170** a gross estimation of number of memory "blocks" allocated
171** (a block is *roughly* 32 bytes)
172*/
173
174extern char *luaO_typenames[]; 169extern char *luaO_typenames[];
175 170
176extern TObject luaO_nilobject; 171extern TObject luaO_nilobject;
diff --git a/lstate.h b/lstate.h
index 3da2e2ef..06b4aced 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.5 1997/11/28 16:56:05 roberto Exp roberto $ 2** $Id: lstate.h,v 1.6 1997/12/17 20:48:58 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -49,8 +49,6 @@ typedef struct LState {
49 struct C_Lua_Stack Cstack; /* C2lua struct */ 49 struct C_Lua_Stack Cstack; /* C2lua struct */
50 void *errorJmp; /* current error recover point */ 50 void *errorJmp; /* current error recover point */
51 TObject errorim; /* error tag method */ 51 TObject errorim; /* error tag method */
52 struct C_Lua_Stack Cblocks[MAX_C_BLOCKS];
53 int numCblocks; /* number of nested Cblocks */
54 GCnode rootproto; /* list of all prototypes */ 52 GCnode rootproto; /* list of all prototypes */
55 GCnode rootcl; /* list of all closures */ 53 GCnode rootcl; /* list of all closures */
56 GCnode roottable; /* list of all tables */ 54 GCnode roottable; /* list of all tables */
@@ -69,6 +67,8 @@ typedef struct LState {
69 char *Mbuffbase; /* current first position of Mbuffer */ 67 char *Mbuffbase; /* current first position of Mbuffer */
70 int Mbuffsize; /* size of Mbuffer */ 68 int Mbuffsize; /* size of Mbuffer */
71 int Mbuffnext; /* next position to fill in Mbuffer */ 69 int Mbuffnext; /* next position to fill in Mbuffer */
70 struct C_Lua_Stack Cblocks[MAX_C_BLOCKS];
71 int numCblocks; /* number of nested Cblocks */
72} LState; 72} LState;
73 73
74 74
diff --git a/lstrlib.c b/lstrlib.c
index 34b9da42..8c963b11 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.5 1997/12/17 20:48:58 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.6 1998/01/09 14:44:55 roberto Exp $
3** Standard library for strings and pattern-matching 3** Standard library for strings and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -109,11 +109,11 @@ static void str_ascii (void)
109#define MAX_CAPT 9 109#define MAX_CAPT 9
110 110
111struct Capture { 111struct Capture {
112 int level; /* total number of captures (finished or unfinished) */
112 struct { 113 struct {
113 char *init; 114 char *init;
114 int len; /* -1 signals unfinished capture */ 115 int len; /* -1 signals unfinished capture */
115 } capture[MAX_CAPT]; 116 } capture[MAX_CAPT];
116 int level; /* total number of captures (finished or unfinished) */
117}; 117};
118 118
119 119
diff --git a/lzio.h b/lzio.h
index 54354a8a..94b79da4 100644
--- a/lzio.h
+++ b/lzio.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lzio.h,v 1.2 1997/11/21 19:00:46 roberto Exp roberto $ 2** $Id: lzio.h,v 1.3 1997/12/22 20:57:18 roberto Exp roberto $
3** Buffered streams 3** Buffered streams
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -42,8 +42,8 @@ struct zio {
42 unsigned char* p; /* current position in buffer */ 42 unsigned char* p; /* current position in buffer */
43 int (*filbuf)(ZIO* z); 43 int (*filbuf)(ZIO* z);
44 void* u; /* additional data */ 44 void* u; /* additional data */
45 unsigned char buffer[ZBSIZE]; /* buffer */
46 char *name; 45 char *name;
46 unsigned char buffer[ZBSIZE]; /* buffer */
47}; 47};
48 48
49 49
diff --git a/manual.tex b/manual.tex
index 18803118..4139955b 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.2 1998/01/06 19:17:31 roberto Exp roberto $ 1% $Id: manual.tex,v 1.3 1998/01/07 16:26:48 roberto Exp roberto $
2 2
3\documentstyle[fullpage,11pt,bnf]{article} 3\documentstyle[fullpage,11pt,bnf]{article}
4 4
@@ -38,7 +38,7 @@ Waldemar Celes
38\tecgraf\ --- Computer Science Department --- PUC-Rio 38\tecgraf\ --- Computer Science Department --- PUC-Rio
39} 39}
40 40
41\date{\small \verb$Date: 1998/01/06 19:17:31 $} 41\date{\small \verb$Date: 1998/01/07 16:26:48 $}
42 42
43\maketitle 43\maketitle
44 44
@@ -1658,9 +1658,9 @@ void lua_pushCclosure (lua_CFunction fn, int n);
1658\end{verbatim} 1658\end{verbatim}
1659is used to put the C function on C2lua, 1659is used to put the C function on C2lua,
1660with the argument \verb|n| telling how many upvalues must be 1660with the argument \verb|n| telling how many upvalues must be
1661associated with the function 1661associated with the function;
1662(notice that the macro \verb|lua_pushcfunction| is defined as 1662in fact, the macro \verb|lua_pushcfunction| is defined as
1663\verb|lua_pushCclosure| with \verb|n| set to 0). 1663\verb|lua_pushCclosure| with \verb|n| set to 0.
1664Then, any time the function is called, 1664Then, any time the function is called,
1665these upvalues are inserted as the first arguments to the function, 1665these upvalues are inserted as the first arguments to the function,
1666before the actual arguments provided in the call. 1666before the actual arguments provided in the call.
@@ -1718,10 +1718,11 @@ Currently there are three standard libraries:
1718\item mathematical functions (sin, log, etc); 1718\item mathematical functions (sin, log, etc);
1719\item input and output (plus some system facilities). 1719\item input and output (plus some system facilities).
1720\end{itemize} 1720\end{itemize}
1721In order to have access to these libraries, 1721To have access to these libraries,
1722the C host program must call the functions 1722the C host program must call the functions
1723\verb|lua_strlibopen|, \verb|lua_mathlibopen|, and \verb|lua_iolibopen|, 1723\verb|lua_strlibopen|, \verb|lua_mathlibopen|,
1724declared in \verb|lualib.h|. 1724and \verb|lua_iolibopen|, declared in \verb|lualib.h|.
1725\Deffunc{lua_strlibopen}\Deffunc{lua_mathlibopen}\Deffunc{lua_iolibopen}.
1725 1726
1726 1727
1727\subsection{Predefined Functions} \label{predefined} 1728\subsection{Predefined Functions} \label{predefined}
@@ -2708,11 +2709,11 @@ Here is a list of all these incompatibilities.
2708\subsection*{Incompatibilities with \Index{version 3.0}} 2709\subsection*{Incompatibilities with \Index{version 3.0}}
2709\begin{itemize} 2710\begin{itemize}
2710 2711
2711\item To support for multiple contexts, 2712\item To support multiple contexts,
2712the whole library must be explicitly opened before used. 2713Lua 3.1 must be explicitly opened before used.
2713However, all standard libraries check whether Lua is already opened, 2714However, all standard libraries check whether Lua is already opened,
2714so any program that opens at least one standard library before using 2715so any program that opens at least one standard library before using
2715Lua API does not need to be corrected. 2716Lua API does not need to be modified.
2716 2717
2717\item Function \verb|dostring| does not accept an optional second argument, 2718\item Function \verb|dostring| does not accept an optional second argument,
2718with a temporary error method. 2719with a temporary error method.
@@ -2725,7 +2726,8 @@ Closures make this feature irrelevant.
2725\item The syntax for function declaration is now more restricted; 2726\item The syntax for function declaration is now more restricted;
2726for instance, the old syntax \verb|function f[exp] (x) ... end| is not 2727for instance, the old syntax \verb|function f[exp] (x) ... end| is not
2727accepted in 3.1. 2728accepted in 3.1.
2728Programs should use an explicit assignment instead, like this: 2729In these cases,
2730programs should use an explicit assignment instead, like
2729\verb|f[exp] = function (x) ... end|. 2731\verb|f[exp] = function (x) ... end|.
2730 2732
2731\item Old pre-compiled code is obsolete, and must be re-compiled. 2733\item Old pre-compiled code is obsolete, and must be re-compiled.