commit 6a853fcb8b9e333d768c739c36c99b144bbde607
parent 31bea2190b25e5b6687d92d807af522378168bfa
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 25 Feb 1999 18:07:04 -0300
details (from lhf)
Diffstat:
13 files changed, 106 insertions(+), 103 deletions(-)
diff --git a/lapi.c b/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 1.37 1999/02/22 19:13:12 roberto Exp roberto $
+** $Id: lapi.c,v 1.38 1999/02/23 14:57:28 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -477,7 +477,7 @@ int luaA_next (Hash *t, int i) {
int lua_next (lua_Object o, int i) {
TObject *t = Address(o);
if (ttype(t) != LUA_T_ARRAY)
- lua_error("API error: object is not a table in `lua_next'");
+ lua_error("API error - object is not a table in `lua_next'");
i = luaA_next(avalue(t), i);
top2LC((i==0) ? 0 : 2);
return i;
@@ -620,7 +620,7 @@ static int checkfunc (TObject *o)
char *lua_getobjname (lua_Object o, char **name)
{ /* try to find a name for given function */
- set_normalized(L->stack.top, Address(o)); /* to be accessed by "checkfunc */
+ set_normalized(L->stack.top, Address(o)); /* to be accessed by "checkfunc" */
if ((*name = luaT_travtagmethods(checkfunc)) != NULL)
return "tag-method";
else if ((*name = luaS_travsymbol(checkfunc)) != NULL)
diff --git a/lauxlib.c b/lauxlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.c,v 1.12 1998/06/19 16:14:09 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.13 1998/09/07 18:59:59 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -10,9 +10,10 @@
#include <string.h>
/* Please Notice: This file uses only the official API of Lua
-** Any function declared here could be written as an application
-** function. With care, these functions can be used by other libraries.
+** Any function declared here could be written as an application function.
+** With care, these functions can be used by other libraries.
*/
+
#include "lauxlib.h"
#include "lua.h"
#include "luadebug.h"
@@ -33,7 +34,7 @@ void luaL_argerror (int numarg, char *extramsg) {
lua_getobjname(f, &funcname);
numarg -= lua_nups(f);
if (funcname == NULL)
- funcname = "???";
+ funcname = "(unknown)";
if (extramsg == NULL)
luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname);
else
diff --git a/llex.c b/llex.c
@@ -1,6 +1,6 @@
/*
-** $Id: llex.c,v 1.28 1999/02/04 17:47:59 roberto Exp roberto $
-** Lexical Analizer
+** $Id: llex.c,v 1.29 1999/02/25 15:17:01 roberto Exp roberto $
+** Lexical Analyzer
** See Copyright Notice in lua.h
*/
diff --git a/llex.h b/llex.h
@@ -1,6 +1,6 @@
/*
-** $Id: llex.h,v 1.9 1998/06/19 16:14:09 roberto Exp roberto $
-** Lexical Analizer
+** $Id: llex.h,v 1.10 1998/07/24 18:02:38 roberto Exp roberto $
+** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -30,7 +30,7 @@ enum RESERVED {
/* "ifstate" keeps the state of each nested $if the lexical is dealing with. */
struct ifState {
- int elsepart; /* true if its in the $else part */
+ int elsepart; /* true if it's in the $else part */
int condition; /* true if $if condition is true */
int skip; /* true if part must be skipped */
};
diff --git a/lmem.c b/lmem.c
@@ -1,5 +1,5 @@
/*
-** $Id: lmem.c,v 1.10 1999/02/24 17:55:51 roberto Exp roberto $
+** $Id: lmem.c,v 1.11 1999/02/25 15:16:26 roberto Exp roberto $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/
@@ -59,7 +59,7 @@ void *luaM_growaux (void *block, unsigned long nelems, int inc, int size,
void *luaM_realloc (void *block, unsigned long size) {
size_t s = (size_t)size;
if (s != size)
- lua_error("Allocation Error: Block too big");
+ lua_error("memory allocation error: block too big");
if (size == 0) {
free(block); /* block may be NULL, that is OK for free */
return NULL;
@@ -100,7 +100,7 @@ static void *checkblock (void *block) {
void *luaM_realloc (void *block, unsigned long size) {
unsigned long realsize = HEADER+size+1;
if (realsize != (size_t)realsize)
- lua_error("Allocation Error: Block too big");
+ lua_error("memory allocation error: block too big");
if (size == 0) {
if (block) {
unsigned long *b = (unsigned long *)((char *)block - HEADER);
diff --git a/lopcodes.h b/lopcodes.h
@@ -1,5 +1,5 @@
/*
-** $Id: lopcodes.h,v 1.26 1999/02/23 13:38:38 roberto Exp roberto $
+** $Id: lopcodes.h,v 1.27 1999/02/24 17:55:51 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -17,97 +17,97 @@
typedef enum {
/* name parm before after side effect
-----------------------------------------------------------------------------*/
-ENDCODE,/* - - - */
-RETCODE,/* b - - */
+ENDCODE,/* - - - */
+RETCODE,/* b - - */
-PUSHNIL,/* b - nil_0...nil_b */
-POP,/* b - - TOP-=b */
-POPDUP,/* b v v TOP-=b */
+PUSHNIL,/* b - nil_0...nil_b */
+POP,/* b - - TOP-=b */
+POPDUP,/* b v v TOP-=b */
-PUSHNUMBERW,/* w - (float)w */
-PUSHNUMBER,/* b - (float)b */
+PUSHNUMBERW,/* w - (float)w */
+PUSHNUMBER,/* b - (float)b */
-PUSHNUMBERNEGW,/* w - (float)-w */
-PUSHNUMBERNEG,/* b - (float)-b */
+PUSHNUMBERNEGW,/* w - (float)-w */
+PUSHNUMBERNEG,/* b - (float)-b */
-PUSHCONSTANTW,/*w - CNST[w] */
-PUSHCONSTANT,/* b - CNST[b] */
+PUSHCONSTANTW,/*w - CNST[w] */
+PUSHCONSTANT,/* b - CNST[b] */
-PUSHUPVALUE,/* b - Closure[b] */
+PUSHUPVALUE,/* b - Closure[b] */
-PUSHLOCAL,/* b - LOC[b] */
+PUSHLOCAL,/* b - LOC[b] */
-GETGLOBALW,/* w - VAR[CNST[w]] */
-GETGLOBAL,/* b - VAR[CNST[b]] */
+GETGLOBALW,/* w - VAR[CNST[w]] */
+GETGLOBAL,/* b - VAR[CNST[b]] */
-GETTABLE,/* - i t t[i] */
+GETTABLE,/* - i t t[i] */
-GETDOTTEDW,/* w t t[CNST[w]] */
-GETDOTTED,/* b t t[CNST[b]] */
+GETDOTTEDW,/* w t t[CNST[w]] */
+GETDOTTED,/* b t t[CNST[b]] */
-PUSHSELFW,/* w t t t[CNST[w]] */
-PUSHSELF,/* b t t t[CNST[b]] */
+PUSHSELFW,/* w t t t[CNST[w]] */
+PUSHSELF,/* b t t t[CNST[b]] */
-CREATEARRAYW,/* w - newarray(size = w) */
-CREATEARRAY,/* b - newarray(size = b) */
+CREATEARRAYW,/* w - newarray(size = w) */
+CREATEARRAY,/* b - newarray(size = b) */
-SETLOCAL,/* b x - LOC[b]=x */
-SETLOCALDUP,/* b x x LOC[b]=x */
+SETLOCAL,/* b x - LOC[b]=x */
+SETLOCALDUP,/* b x x LOC[b]=x */
-SETGLOBALW,/* w x - VAR[CNST[w]]=x */
-SETGLOBAL,/* b x - VAR[CNST[b]]=x */
-SETGLOBALDUPW,/*w x x VAR[CNST[w]]=x */
-SETGLOBALDUP,/* b x x VAR[CNST[b]]=x */
+SETGLOBALW,/* w x - VAR[CNST[w]]=x */
+SETGLOBAL,/* b x - VAR[CNST[b]]=x */
+SETGLOBALDUPW,/*w x x VAR[CNST[w]]=x */
+SETGLOBALDUP,/* b x x VAR[CNST[b]]=x */
-SETTABLEPOP,/* - v i t - t[i]=v */
-SETTABLEPOPDUP,/* - v i t v t[i]=v */
+SETTABLEPOP,/* - v i t - t[i]=v */
+SETTABLEPOPDUP,/* - v i t v t[i]=v */
-SETTABLE,/* b v a_b...a_1 i t a_b...a_1 i t t[i]=v */
-SETTABLEDUP,/* b v a_b...a_1 i t v a_b...a_1 i t t[i]=v */
+SETTABLE,/* b v a_b...a_1 i t a_b...a_1 i t t[i]=v */
+SETTABLEDUP,/* b v a_b...a_1 i t v a_b...a_1 i t t[i]=v */
-SETLISTW,/* w c v_c...v_1 t - t[i+w*FPF]=v_i */
-SETLIST,/* b c v_c...v_1 t - t[i+b*FPF]=v_i */
+SETLISTW,/* w c v_c...v_1 t - t[i+w*FPF]=v_i */
+SETLIST,/* b c v_c...v_1 t - t[i+b*FPF]=v_i */
-SETMAP,/* b v_b k_b ...v_0 k_0 t t t[k_i]=v_i */
+SETMAP,/* b v_b k_b ...v_0 k_0 t t t[k_i]=v_i */
-NEQOP,/* - y x (x~=y)? 1 : nil */
-EQOP,/* - y x (x==y)? 1 : nil */
-LTOP,/* - y x (x<y)? 1 : nil */
-LEOP,/* - y x (x<y)? 1 : nil */
-GTOP,/* - y x (x>y)? 1 : nil */
-GEOP,/* - y x (x>=y)? 1 : nil */
-ADDOP,/* - y x x+y */
-SUBOP,/* - y x x-y */
-MULTOP,/* - y x x*y */
-DIVOP,/* - y x x/y */
-POWOP,/* - y x x^y */
-CONCOP,/* - y x x..y */
-MINUSOP,/* - x -x */
-NOTOP,/* - x (x==nil)? 1 : nil */
+NEQOP,/* - y x (x~=y)? 1 : nil */
+EQOP,/* - y x (x==y)? 1 : nil */
+LTOP,/* - y x (x<y)? 1 : nil */
+LEOP,/* - y x (x<y)? 1 : nil */
+GTOP,/* - y x (x>y)? 1 : nil */
+GEOP,/* - y x (x>=y)? 1 : nil */
+ADDOP,/* - y x x+y */
+SUBOP,/* - y x x-y */
+MULTOP,/* - y x x*y */
+DIVOP,/* - y x x/y */
+POWOP,/* - y x x^y */
+CONCOP,/* - y x x..y */
+MINUSOP,/* - x -x */
+NOTOP,/* - x (x==nil)? 1 : nil */
-ONTJMPW,/* w x (x!=nil)? x : - (x!=nil)? PC+=w */
-ONTJMP,/* b x (x!=nil)? x : - (x!=nil)? PC+=b */
-ONFJMPW,/* w x (x==nil)? x : - (x==nil)? PC+=w */
-ONFJMP,/* b x (x==nil)? x : - (x==nil)? PC+=b */
-JMPW,/* w - - PC+=w */
-JMP,/* b - - PC+=b */
-IFFJMPW,/* w x - (x==nil)? PC+=w */
-IFFJMP,/* b x - (x==nil)? PC+=b */
-IFTUPJMPW,/* w x - (x!=nil)? PC-=w */
-IFTUPJMP,/* b x - (x!=nil)? PC-=b */
-IFFUPJMPW,/* w x - (x==nil)? PC-=w */
-IFFUPJMP,/* b x - (x==nil)? PC-=b */
+ONTJMPW,/* w x (x!=nil)? x : - (x!=nil)? PC+=w */
+ONTJMP,/* b x (x!=nil)? x : - (x!=nil)? PC+=b */
+ONFJMPW,/* w x (x==nil)? x : - (x==nil)? PC+=w */
+ONFJMP,/* b x (x==nil)? x : - (x==nil)? PC+=b */
+JMPW,/* w - - PC+=w */
+JMP,/* b - - PC+=b */
+IFFJMPW,/* w x - (x==nil)? PC+=w */
+IFFJMP,/* b x - (x==nil)? PC+=b */
+IFTUPJMPW,/* w x - (x!=nil)? PC-=w */
+IFTUPJMP,/* b x - (x!=nil)? PC-=b */
+IFFUPJMPW,/* w x - (x==nil)? PC-=w */
+IFFUPJMP,/* b x - (x==nil)? PC-=b */
-CLOSUREW,/* w c v_c...v_1 closure(CNST[w], v_c...v_1) */
-CLOSURE,/* b c v_c...v_1 closure(CNST[b], v_c...v_1) */
+CLOSUREW,/* w c v_c...v_1 closure(CNST[w], v_c...v_1) */
+CLOSURE,/* b c v_c...v_1 closure(CNST[b], v_c...v_1) */
-CALLFUNC,/* b c v_c...v_1 f r_b...r_1 f(v1,...,v_c) */
+CALLFUNC,/* b c v_c...v_1 f r_b...r_1 f(v1,...,v_c) */
-SETLINEW,/* w - - LINE=w */
-SETLINE,/* b - - LINE=b */
+SETLINEW,/* w - - LINE=w */
+SETLINE,/* b - - LINE=b */
-LONGARGW,/* w (add w*(1<<16) to arg of next instruction) */
-LONGARG,/* b (add b*(1<<16) to arg of next instruction) */
+LONGARGW,/* w (add w*(1<<16) to arg of next instruction) */
+LONGARG,/* b (add b*(1<<16) to arg of next instruction) */
CHECKSTACK /* b (assert #temporaries == b; only for internal debuging!) */
diff --git a/lparser.c b/lparser.c
@@ -1,5 +1,5 @@
/*
-** $Id: lparser.c,v 1.22 1999/02/24 17:55:51 roberto Exp roberto $
+** $Id: lparser.c,v 1.23 1999/02/25 15:16:26 roberto Exp roberto $
** LL(1) Parser and code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -926,7 +926,7 @@ static void exp1 (LexState *ls) {
exp0(ls, &v);
lua_pushvar(ls, &v);
if (is_in(ls->token, expfollow) < 0)
- luaX_error(ls, "ill formed expression");
+ luaX_error(ls, "ill-formed expression");
}
diff --git a/lparser.h b/lparser.h
@@ -1,6 +1,6 @@
/*
-** $Id: lparser.h,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $
-** Syntax analizer and code generator
+** $Id: lparser.h,v 1.2 1997/12/22 20:57:18 roberto Exp roberto $
+** LL(1) Parser and code generator for Lua
** See Copyright Notice in lua.h
*/
diff --git a/lstrlib.c b/lstrlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstrlib.c,v 1.25 1999/02/05 11:22:58 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.26 1999/02/12 19:23:02 roberto Exp roberto $
** Standard library for strings and pattern-matching
** See Copyright Notice in lua.h
*/
@@ -532,7 +532,7 @@ static struct luaL_reg strlib[] = {
{"strupper", str_upper},
{"strchar", str_char},
{"strrep", str_rep},
-{"ascii", str_byte}, /* for compatibility */
+{"ascii", str_byte}, /* for compatibility with 3.0 and earlier */
{"strbyte", str_byte},
{"format", str_format},
{"strfind", str_find},
diff --git a/ltm.c b/ltm.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltm.c,v 1.21 1999/02/04 18:59:31 roberto Exp roberto $
+** $Id: ltm.c,v 1.22 1999/02/25 15:16:26 roberto Exp roberto $
** Tag methods
** See Copyright Notice in lua.h
*/
@@ -82,7 +82,7 @@ static void checktag (int tag) {
void luaT_realtag (int tag) {
if (!(L->last_tag <= tag && tag < LUA_T_NIL))
- luaL_verror("tag %d is not result of `newtag'", tag);
+ luaL_verror("tag %d was not created by `newtag'", tag);
}
diff --git a/lua.h b/lua.h
@@ -1,5 +1,5 @@
/*
-** $Id: lua.h,v 1.28 1999/02/22 19:13:12 roberto Exp roberto $
+** $Id: lua.h,v 1.29 1999/02/23 14:57:28 roberto Exp roberto $
** Lua - An Extensible Extension Language
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
** e-mail: lua@tecgraf.puc-rio.br
@@ -188,5 +188,6 @@ lua_Object lua_setfallback (char *event, lua_CFunction fallback);
* The Lua language and this implementation have been entirely designed and
* written by Waldemar Celes Filho, Roberto Ierusalimschy and
* Luiz Henrique de Figueiredo at TeCGraf, PUC-Rio.
+*
* This implementation contains no third-party code.
******************************************************************************/
diff --git a/lzio.c b/lzio.c
@@ -1,5 +1,5 @@
/*
-** $Id: lzio.c,v 1.3 1997/12/22 20:57:18 roberto Exp roberto $
+** $Id: lzio.c,v 1.4 1998/12/28 13:44:54 roberto Exp roberto $
** a generic input stream interface
** See Copyright Notice in lua.h
*/
@@ -64,16 +64,15 @@ ZIO* zFopen (ZIO* z, FILE* f, char *name)
/* --------------------------------------------------------------- read --- */
-int zread (ZIO *z, void *b, int n)
-{
+int zread (ZIO *z, void *b, int n) {
while (n) {
int m;
if (z->n == 0) {
if (z->filbuf(z) == EOZ)
- return n; /* retorna quantos faltaram ler */
- zungetc(z); /* poe o resultado de filbuf no buffer */
+ return n; /* return number of missing bytes */
+ zungetc(z); /* put result from 'filbuf' in the buffer */
}
- m = (n <= z->n) ? n : z->n; /* minimo de n e z->n */
+ m = (n <= z->n) ? n : z->n; /* min. between n and z->n */
memcpy(b, z->p, m);
z->n -= m;
z->p += m;
diff --git a/manual.tex b/manual.tex
@@ -1,4 +1,4 @@
-% $Id: manual.tex,v 1.22 1999/02/05 12:15:07 roberto Exp roberto $
+% $Id: manual.tex,v 1.23 1999/02/12 19:23:02 roberto Exp roberto $
\documentclass[11pt]{article}
\usepackage{fullpage,bnf}
@@ -41,7 +41,7 @@ Waldemar Celes
\tecgraf\ --- Computer Science Department --- PUC-Rio
}
-%\date{\small \verb$Date: 1999/02/05 12:15:07 $}
+%\date{\small \verb$Date: 1999/02/12 19:23:02 $}
\maketitle
@@ -122,8 +122,10 @@ and its documentation.
\noindent
The Lua language and this implementation have been entirely designed and
written by Waldemar Celes, Roberto Ierusalimschy and Luiz Henrique de
-Figueiredo at TeCGraf, PUC-Rio. This implementation contains no third-party
-code.
+Figueiredo at TeCGraf, PUC-Rio.
+
+\noindent
+This implementation contains no third-party code.
\end{quotation}
\newpage