comments.

This commit is contained in:
Roberto Ierusalimschy 1999-12-27 15:33:22 -02:00
parent 5b08fcd5a1
commit acdb0b741e
20 changed files with 65 additions and 65 deletions

4
lapi.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 1.64 1999/12/14 18:31:20 roberto Exp roberto $
** $Id: lapi.c,v 1.65 1999/12/23 18:19:57 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@ -79,7 +79,7 @@ lua_Object luaA_putObjectOnTop (lua_State *L) {
static void top2LC (lua_State *L, int n) {
/* Put the 'n' elements on the top as the Lua2C contents */
/* Put the `n' elements on the top as the Lua2C contents */
L->Cstack.base = L->top; /* new base */
L->Cstack.lua2C = L->Cstack.base-n; /* position of the new results */
L->Cstack.num = n; /* number of results */

View File

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.21 1999/11/22 13:12:07 roberto Exp roberto $
** $Id: lauxlib.c,v 1.22 1999/12/20 13:09:45 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -9,7 +9,7 @@
#include <stdio.h>
#include <string.h>
/* Please Notice: This file uses only the official API of Lua
/* 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.
*/
@ -113,7 +113,7 @@ void luaL_verror (lua_State *L, const char *fmt, ...) {
}
#define EXTRALEN 13 /* > strlen('string "..."\0') */
#define EXTRALEN sizeof("string \"...\"0")
void luaL_chunkid (char *out, const char *source, int len) {
if (*source == '(') {
@ -129,7 +129,7 @@ void luaL_chunkid (char *out, const char *source, int len) {
const char *b = strchr(source , '\n'); /* stop at first new line */
int lim = (b && (b-source)<len) ? b-source : len;
sprintf(out, "string \"%.*s\"", lim, source);
strcpy(out+lim+(EXTRALEN-5), "...\""); /* 5 = strlen("...'\0") */
strcpy(out+lim+(EXTRALEN-sizeof("...\"0")), "...\"");
}
}
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lbuiltin.c,v 1.87 1999/12/23 18:19:57 roberto Exp roberto $
** $Id: lbuiltin.c,v 1.88 1999/12/27 13:04:53 roberto Exp roberto $
** Built-in functions
** See Copyright Notice in lua.h
*/
@ -94,16 +94,16 @@ static Hash *gettable (lua_State *L, int arg) {
** If your system does not support "stderr", redefine this function, or
** redefine _ERRORMESSAGE so that it won't need _ALERT.
*/
void luaB_alert (lua_State *L) {
void luaB__alert (lua_State *L) {
fputs(luaL_check_string(L, 1), stderr);
}
/*
** Standard implementation of _ERRORMESSAGE.
** The library "iolib" redefines _ERRORMESSAGE for better error information.
** The library `liolib' redefines _ERRORMESSAGE for better error information.
*/
void luaB_ERRORMESSAGE (lua_State *L) {
void luaB__ERRORMESSAGE (lua_State *L) {
lua_Object al = lua_rawgetglobal(L, "_ALERT");
if (lua_isfunction(L, al)) { /* avoid error loop if _ALERT is not defined */
char buff[600];
@ -529,7 +529,7 @@ static void swap (lua_State *L, Hash *a, int i, int j) {
static int sort_comp (lua_State *L, lua_Object f, const TObject *a,
const TObject *b) {
/* notice: the caller (auxsort) must check stack space */
/* WARNING: the caller (auxsort) must ensure stack space */
if (f != LUA_NOOBJECT) {
*(L->top) = *f;
*(L->top+1) = *a;
@ -609,8 +609,8 @@ void luaB_sort (lua_State *L) {
static const struct luaL_reg builtin_funcs[] = {
{"_ALERT", luaB_alert},
{"_ERRORMESSAGE", luaB_ERRORMESSAGE},
{"_ALERT", luaB__alert},
{"_ERRORMESSAGE", luaB__ERRORMESSAGE},
{"call", luaB_call},
{"collectgarbage", luaB_collectgarbage},
{"copytagmethods", luaB_copytagmethods},

View File

@ -1,5 +1,5 @@
/*
** $Id: lbuiltin.h,v 1.2 1999/11/22 13:12:07 roberto Exp roberto $
** $Id: lbuiltin.h,v 1.3 1999/12/14 18:33:29 roberto Exp roberto $
** Built-in functions
** See Copyright Notice in lua.h
*/
@ -9,8 +9,8 @@
#include "lua.h"
void luaB_alert (lua_State *L);
void luaB_ERRORMESSAGE (lua_State *L);
void luaB__alert (lua_State *L);
void luaB__ERRORMESSAGE (lua_State *L);
void luaB_print (lua_State *L);
void luaB_tonumber (lua_State *L);
void luaB_error (lua_State *L);

8
ldo.c
View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 1.59 1999/12/21 18:04:41 roberto Exp roberto $
** $Id: ldo.c,v 1.60 1999/12/23 18:19:57 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@ -56,7 +56,7 @@ void luaD_checkstack (lua_State *L, int n) {
else {
L->stack_last += EXTRA_STACK; /* to be used by error message */
if (lua_stackedfunction(L, L->stacksize/SLOTS_PER_F) == LUA_NOOBJECT) {
/* too few funcs on stack: doesn't look like a rec. loop */
/* too few funcs on stack: doesn't look like a recursion loop */
lua_error(L, "Lua2C - C2Lua overflow");
}
else
@ -253,14 +253,14 @@ static void message (lua_State *L, const char *s) {
}
/*
** Reports an error, and jumps up to the available recover label
** Reports an error, and jumps up to the available recovery label
*/
void lua_error (lua_State *L, const char *s) {
if (s) message(L, s);
if (L->errorJmp)
longjmp(L->errorJmp->b, 1);
else {
message(L, "exit(1). Unable to recover.\n");
message(L, "unable to recover. exiting.\n");
exit(1);
}
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lfunc.c,v 1.14 1999/11/10 15:39:35 roberto Exp roberto $
** $Id: lfunc.c,v 1.15 1999/11/22 13:12:07 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
@ -61,7 +61,7 @@ void luaF_freeclosure (lua_State *L, Closure *c) {
/*
** Look for n-th local variable at line "line" in function "func".
** Look for n-th local variable at line `line' in function `func'.
** Returns NULL if not found.
*/
const char *luaF_getlocalname (const TProtoFunc *func,

View File

@ -1,6 +1,6 @@
/*
** $Id: lfunc.h,v 1.8 1999/10/14 19:46:57 roberto Exp roberto $
** Lua Function structures
** $Id: lfunc.h,v 1.9 1999/11/22 13:12:07 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/

6
lgc.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.c,v 1.37 1999/12/21 18:04:41 roberto Exp roberto $
** $Id: lgc.c,v 1.38 1999/12/23 18:19:57 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -181,7 +181,7 @@ static void clear_global_list (lua_State *L, int limit) {
** with limit=MAX_INT, that means all elements.
*/
static void collectstring (lua_State *L, int limit) {
TObject o; /* to call userdata 'gc' tag method */
TObject o; /* to call userdata `gc' tag method */
int i;
ttype(&o) = LUA_T_USERDATA;
clear_global_list(L, limit);
@ -254,7 +254,7 @@ void luaC_collect (lua_State *L, int all) {
long lua_collectgarbage (lua_State *L, long limit) {
unsigned long recovered = L->nblocks; /* to subtract nblocks after gc */
unsigned long recovered = L->nblocks; /* to subtract `nblocks' after gc */
markall(L);
luaR_invalidaterefs(L);
luaC_collect(L, 0);

8
llex.h
View File

@ -1,5 +1,5 @@
/*
** $Id: llex.h,v 1.14 1999/08/16 20:52:00 roberto Exp roberto $
** $Id: llex.h,v 1.15 1999/11/22 13:12:07 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@ -13,7 +13,7 @@
#define FIRST_RESERVED 260
/* maximum length of a reserved word (+1 for terminal 0) */
/* maximum length of a reserved word (+1 for final 0) */
#define TOKEN_LEN 15
@ -34,7 +34,7 @@ enum RESERVED {
#define MAX_IFS 5 /* arbitrary limit */
#endif
/* "ifstate" keeps the state of each nested $if the lexical is dealing with. */
/* `ifState' keeps the state of each nested $if the lexical is dealing with. */
struct ifState {
int elsepart; /* true if it's in the $else part */
@ -46,7 +46,7 @@ struct ifState {
typedef struct LexState {
int current; /* look ahead character */
int token; /* look ahead token */
struct FuncState *fs; /* 'FuncState' is private for the parser */
struct FuncState *fs; /* `FuncState' is private for the parser */
struct lua_State *L;
union {
real r;

View File

@ -1,6 +1,6 @@
/*
** $Id: lmathlib.c,v 1.21 1999/11/22 17:39:51 roberto Exp roberto $
** Lua standard mathematical library
** $Id: lmathlib.c,v 1.22 1999/12/14 18:31:20 roberto Exp roberto $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
@ -147,7 +147,7 @@ static void math_random (lua_State *L) {
some systems (SunOS!) "rand()" may return a value larger than RAND_MAX */
double r = (double)(rand()%RAND_MAX) / (double)RAND_MAX;
if (lua_getparam(L, 1) == LUA_NOOBJECT) /* no arguments? */
lua_pushnumber(L, r); /* real between 0 & 1 */
lua_pushnumber(L, r); /* real between 0 and 1 */
else {
int l, u; /* lower & upper limits */
if (lua_getparam(L, 2) == LUA_NOOBJECT) { /* only one argument? */
@ -159,7 +159,7 @@ static void math_random (lua_State *L) {
u = luaL_check_int(L, 2);
}
luaL_arg_check(L, l<=u, 1, "interval is empty");
lua_pushnumber(L, (int)(r*(u-l+1))+l); /* integer between l & u */
lua_pushnumber(L, (int)(r*(u-l+1))+l); /* integer between `l' and `u' */
}
}

4
lmem.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lmem.c,v 1.21 1999/11/29 16:38:48 roberto Exp roberto $
** $Id: lmem.c,v 1.22 1999/12/14 18:31:20 roberto Exp roberto $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/
@ -49,7 +49,7 @@ void *luaM_realloc (lua_State *L, void *block, unsigned long size) {
if (s != size)
lua_error(L, "memory allocation error: block too big");
if (size == 0) {
free(block); /* block may be NULL, that is OK for free */
free(block); /* block may be NULL; that is OK for free */
return NULL;
}
block = realloc(block, s);

4
lmem.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lmem.h,v 1.9 1999/08/16 20:52:00 roberto Exp roberto $
** $Id: lmem.h,v 1.10 1999/11/22 13:12:07 roberto Exp roberto $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/
@ -18,7 +18,7 @@
#define refEM "reference table overflow"
#define tableEM "table overflow"
#define memEM "not enough memory"
#define arrEM "internal array bigger than `int' limit"
#define arrEM "internal array larger than `int' limit"
void *luaM_realloc (lua_State *L, void *oldblock, unsigned long size);
void *luaM_growaux (lua_State *L, void *block, unsigned long nelems, int inc, int size,

View File

@ -1,5 +1,5 @@
/*
** $Id: lobject.h,v 1.40 1999/12/14 18:33:29 roberto Exp roberto $
** $Id: lobject.h,v 1.41 1999/12/23 18:19:57 roberto Exp roberto $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@ -46,7 +46,7 @@ typedef unsigned char Byte; /* unsigned 8 bits */
#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
/* convertion of pointer to int (for hashing only) */
/* conversion of pointer to int (for hashing only) */
/* (the shift removes bits that are usually 0 because of alignment) */
#define IntPoint(L, p) (((unsigned int)(p)) >> 3)
@ -65,10 +65,10 @@ typedef unsigned char Byte; /* unsigned 8 bits */
** grep "ORDER LUA_T"
*/
typedef enum {
LUA_T_USERDATA = 0, /* tag default for userdata */
LUA_T_USERDATA = 0, /* default tag for userdata */
LUA_T_NUMBER = -1, /* fixed tag for numbers */
LUA_T_STRING = -2, /* fixed tag for strings */
LUA_T_ARRAY = -3, /* tag default for tables (or arrays) */
LUA_T_ARRAY = -3, /* default tag for tables (or arrays) */
LUA_T_LPROTO = -4, /* fixed tag for Lua functions */
LUA_T_CPROTO = -5, /* fixed tag for C functions */
LUA_T_NIL = -6, /* last "pre-defined" tag */
@ -84,7 +84,7 @@ typedef enum {
#define NUM_TAGS 7
/*
** chech whether t is a mark; ttypes are negative numbers, so the
** chech whether `t' is a mark; ttypes are negative numbers, so the
** comparisons look reversed. (ORDER LUA_T)
*/
#define is_T_MARK(t) (LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK)
@ -181,7 +181,7 @@ typedef struct LocVar {
typedef struct Closure {
struct Closure *next;
int marked;
int nelems; /* not included the first one (always the prototype) */
int nelems; /* not including the first one (always the prototype) */
TObject consts[1]; /* at least one for prototype */
} Closure;

View File

@ -1,5 +1,5 @@
/*
** $Id: lopcodes.h,v 1.33 1999/06/17 17:04:03 roberto Exp roberto $
** $Id: lopcodes.h,v 1.34 1999/11/25 18:59:43 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -121,7 +121,7 @@ LONGARG /* b (add b*(1<<16) to arg of next instruction) */
#define MAX_ARG ((1<<24)-1)
#endif
/* maximum value of a word of 2 bytes; cannot be bigger than MAX_ARG */
/* maximum value of a word of 2 bytes; cannot be larger than MAX_ARG */
#if MAX_ARG < (1<<16)
#define MAX_WORD MAX_ARG
#else

4
lref.c
View File

@ -1,6 +1,6 @@
/*
** $Id: lref.c,v 1.4 1999/12/14 18:31:20 roberto Exp roberto $
** REF mechanism
** $Id: lref.c,v 1.5 1999/12/23 18:19:57 roberto Exp roberto $
** reference mechanism
** See Copyright Notice in lua.h
*/

4
lref.h
View File

@ -1,6 +1,6 @@
/*
** $Id: lref.h,v 1.3 1999/11/22 13:12:07 roberto Exp roberto $
** REF mechanism
** $Id: lref.h,v 1.4 1999/12/14 18:33:29 roberto Exp roberto $
** reference mechanism
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.h,v 1.25 1999/12/06 11:41:28 roberto Exp roberto $
** $Id: lstate.h,v 1.26 1999/12/21 18:04:41 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@ -19,7 +19,7 @@ typedef TObject *StkId; /* index to stack elements */
/*
** "jmp_buf" may be an array, so it is better to make sure it has an
** `jmp_buf' may be an array, so it is better to make sure it has an
** address (and not that it *is* an address...)
*/
struct lua_longjmp {
@ -74,7 +74,7 @@ struct lua_State {
int refSize; /* size of refArray */
int refFree; /* list of free positions in refArray */
unsigned long GCthreshold;
unsigned long nblocks; /* number of 'blocks' currently allocated */
unsigned long nblocks; /* number of `blocks' currently allocated */
int debug;
lua_CHFunction callhook;
lua_LHFunction linehook;

View File

@ -1,6 +1,6 @@
/*
** $Id: lstrlib.c,v 1.37 1999/11/22 13:12:07 roberto Exp roberto $
** Standard library for strings and pattern-matching
** $Id: lstrlib.c,v 1.38 1999/11/22 17:39:51 roberto Exp roberto $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ltests.c,v 1.1 1999/12/14 18:31:20 roberto Exp roberto $
** $Id: ltests.c,v 1.2 1999/12/23 18:19:57 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@ -163,7 +163,7 @@ static void testC (lua_State *L) {
}
else if EQ("getparam") {
int n = getreg(L, &pc);
reg[n] = lua_getparam(L, getnum(&pc)+1); /* skips the commmand itself */
reg[n] = lua_getparam(L, getnum(&pc)+1); /* skips the command itself */
}
else if EQ("getresult") {
int n = getreg(L, &pc);

14
lvm.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 1.74 1999/12/21 18:04:41 roberto Exp roberto $
** $Id: lvm.c,v 1.75 1999/12/23 18:19:57 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -135,21 +135,21 @@ void luaV_gettable (lua_State *L) {
*/
void luaV_settable (lua_State *L, StkId t) {
const TObject *im;
if (ttype(t) != LUA_T_ARRAY) { /* not a table, get "settable" method */
if (ttype(t) != LUA_T_ARRAY) { /* not a table, get `settable' method */
im = luaT_getimbyObj(L, t, IM_SETTABLE);
if (ttype(im) == LUA_T_NIL)
lua_error(L, "indexed expression not a table");
}
else { /* object is a table... */
im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE);
if (ttype(im) == LUA_T_NIL) { /* and does not have a "settable" method */
if (ttype(im) == LUA_T_NIL) { /* and does not have a `settable' method */
luaH_set(L, avalue(t), t+1, L->top-1);
L->top--; /* pop value */
return;
}
/* else it has a "settable" method, go through to next command */
/* else it has a `settable' method, go through to next command */
}
/* object is not a table, or it has a "settable" method */
/* object is not a table, or it has a `settable' method */
/* prepare arguments and call the tag method */
*(L->top+1) = *(L->top-1);
*(L->top) = *(t+1);
@ -210,7 +210,7 @@ static void call_binTM (lua_State *L, StkId top, IMS event, const char *msg) {
if (ttype(im) == LUA_T_NIL) {
im = luaT_getimbyObj(L, top-1, event); /* try second operand */
if (ttype(im) == LUA_T_NIL) {
im = luaT_getim(L, 0, event); /* try a 'global' i.m. */
im = luaT_getim(L, 0, event); /* try a `global' method */
if (ttype(im) == LUA_T_NIL)
lua_error(L, msg);
}
@ -603,7 +603,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
case LONGARGW: aux += highbyte(L, *pc++);
case LONGARG: aux += *pc++;
aux = highbyte(L, highbyte(L, aux));
goto switchentry; /* do not reset "aux" */
goto switchentry; /* do not reset `aux' */
}
}