diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-09 12:57:43 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-09 12:57:43 -0200 |
commit | 6ac047afc46cbee935587b5734ec37d2e667a598 (patch) | |
tree | 9dd53dcde6b44b1b2593420a13cbd828261a690e | |
parent | 0e1058cfdd07a3751fce1c79b75241cf770266cf (diff) | |
download | lua-6ac047afc46cbee935587b5734ec37d2e667a598.tar.gz lua-6ac047afc46cbee935587b5734ec37d2e667a598.tar.bz2 lua-6ac047afc46cbee935587b5734ec37d2e667a598.zip |
details
-rw-r--r-- | llex.h | 4 | ||||
-rw-r--r-- | lobject.h | 13 | ||||
-rw-r--r-- | lstate.h | 6 | ||||
-rw-r--r-- | lstrlib.c | 4 | ||||
-rw-r--r-- | lzio.h | 4 | ||||
-rw-r--r-- | manual.tex | 26 |
6 files changed, 27 insertions, 30 deletions
@@ -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 | ||
@@ -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 | */ |
112 | typedef struct TProtoFunc { | 112 | typedef 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 | |||
174 | extern char *luaO_typenames[]; | 169 | extern char *luaO_typenames[]; |
175 | 170 | ||
176 | extern TObject luaO_nilobject; | 171 | extern TObject luaO_nilobject; |
@@ -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 | ||
@@ -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 | ||
111 | struct Capture { | 111 | struct 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 | ||
@@ -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 | ||
@@ -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} |
1659 | is used to put the C function on C2lua, | 1659 | is used to put the C function on C2lua, |
1660 | with the argument \verb|n| telling how many upvalues must be | 1660 | with the argument \verb|n| telling how many upvalues must be |
1661 | associated with the function | 1661 | associated with the function; |
1662 | (notice that the macro \verb|lua_pushcfunction| is defined as | 1662 | in 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. |
1664 | Then, any time the function is called, | 1664 | Then, any time the function is called, |
1665 | these upvalues are inserted as the first arguments to the function, | 1665 | these upvalues are inserted as the first arguments to the function, |
1666 | before the actual arguments provided in the call. | 1666 | before 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} |
1721 | In order to have access to these libraries, | 1721 | To have access to these libraries, |
1722 | the C host program must call the functions | 1722 | the 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|, |
1724 | declared in \verb|lualib.h|. | 1724 | and \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, |
2712 | the whole library must be explicitly opened before used. | 2713 | Lua 3.1 must be explicitly opened before used. |
2713 | However, all standard libraries check whether Lua is already opened, | 2714 | However, all standard libraries check whether Lua is already opened, |
2714 | so any program that opens at least one standard library before using | 2715 | so any program that opens at least one standard library before using |
2715 | Lua API does not need to be corrected. | 2716 | Lua 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, |
2718 | with a temporary error method. | 2719 | with 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; |
2726 | for instance, the old syntax \verb|function f[exp] (x) ... end| is not | 2727 | for instance, the old syntax \verb|function f[exp] (x) ... end| is not |
2727 | accepted in 3.1. | 2728 | accepted in 3.1. |
2728 | Programs should use an explicit assignment instead, like this: | 2729 | In these cases, |
2730 | programs 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. |