diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-27 15:33:22 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-27 15:33:22 -0200 |
| commit | acdb0b741e31adebfa4f608f8bf23e65fa68d741 (patch) | |
| tree | a4f3bb695c4b2ae03ef8e02d15953bc12de25a9d | |
| parent | 5b08fcd5a1392a7440cae91e68f350a44b136806 (diff) | |
| download | lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.tar.gz lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.tar.bz2 lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.zip | |
comments.
Diffstat (limited to '')
| -rw-r--r-- | lapi.c | 4 | ||||
| -rw-r--r-- | lauxlib.c | 8 | ||||
| -rw-r--r-- | lbuiltin.c | 14 | ||||
| -rw-r--r-- | lbuiltin.h | 6 | ||||
| -rw-r--r-- | ldo.c | 8 | ||||
| -rw-r--r-- | lfunc.c | 4 | ||||
| -rw-r--r-- | lfunc.h | 4 | ||||
| -rw-r--r-- | lgc.c | 6 | ||||
| -rw-r--r-- | llex.h | 8 | ||||
| -rw-r--r-- | lmathlib.c | 8 | ||||
| -rw-r--r-- | lmem.c | 4 | ||||
| -rw-r--r-- | lmem.h | 4 | ||||
| -rw-r--r-- | lobject.h | 12 | ||||
| -rw-r--r-- | lopcodes.h | 4 | ||||
| -rw-r--r-- | lref.c | 4 | ||||
| -rw-r--r-- | lref.h | 4 | ||||
| -rw-r--r-- | lstate.h | 6 | ||||
| -rw-r--r-- | lstrlib.c | 4 | ||||
| -rw-r--r-- | ltests.c | 4 | ||||
| -rw-r--r-- | lvm.c | 14 |
20 files changed, 65 insertions, 65 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.64 1999/12/14 18:31:20 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.65 1999/12/23 18:19:57 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -79,7 +79,7 @@ lua_Object luaA_putObjectOnTop (lua_State *L) { | |||
| 79 | 79 | ||
| 80 | 80 | ||
| 81 | static void top2LC (lua_State *L, int n) { | 81 | static void top2LC (lua_State *L, int n) { |
| 82 | /* Put the 'n' elements on the top as the Lua2C contents */ | 82 | /* Put the `n' elements on the top as the Lua2C contents */ |
| 83 | L->Cstack.base = L->top; /* new base */ | 83 | L->Cstack.base = L->top; /* new base */ |
| 84 | L->Cstack.lua2C = L->Cstack.base-n; /* position of the new results */ | 84 | L->Cstack.lua2C = L->Cstack.base-n; /* position of the new results */ |
| 85 | L->Cstack.num = n; /* number of results */ | 85 | L->Cstack.num = n; /* number of results */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.21 1999/11/22 13:12:07 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.22 1999/12/20 13:09:45 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| 10 | #include <string.h> | 10 | #include <string.h> |
| 11 | 11 | ||
| 12 | /* Please Notice: This file uses only the official API of Lua | 12 | /* This file uses only the official API of Lua. |
| 13 | ** Any function declared here could be written as an application function. | 13 | ** Any function declared here could be written as an application function. |
| 14 | ** With care, these functions can be used by other libraries. | 14 | ** With care, these functions can be used by other libraries. |
| 15 | */ | 15 | */ |
| @@ -113,7 +113,7 @@ void luaL_verror (lua_State *L, const char *fmt, ...) { | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | #define EXTRALEN 13 /* > strlen('string "..."\0') */ | 116 | #define EXTRALEN sizeof("string \"...\"0") |
| 117 | 117 | ||
| 118 | void luaL_chunkid (char *out, const char *source, int len) { | 118 | void luaL_chunkid (char *out, const char *source, int len) { |
| 119 | if (*source == '(') { | 119 | if (*source == '(') { |
| @@ -129,7 +129,7 @@ void luaL_chunkid (char *out, const char *source, int len) { | |||
| 129 | const char *b = strchr(source , '\n'); /* stop at first new line */ | 129 | const char *b = strchr(source , '\n'); /* stop at first new line */ |
| 130 | int lim = (b && (b-source)<len) ? b-source : len; | 130 | int lim = (b && (b-source)<len) ? b-source : len; |
| 131 | sprintf(out, "string \"%.*s\"", lim, source); | 131 | sprintf(out, "string \"%.*s\"", lim, source); |
| 132 | strcpy(out+lim+(EXTRALEN-5), "...\""); /* 5 = strlen("...'\0") */ | 132 | strcpy(out+lim+(EXTRALEN-sizeof("...\"0")), "...\""); |
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.87 1999/12/23 18:19:57 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.88 1999/12/27 13:04:53 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -94,16 +94,16 @@ static Hash *gettable (lua_State *L, int arg) { | |||
| 94 | ** If your system does not support "stderr", redefine this function, or | 94 | ** If your system does not support "stderr", redefine this function, or |
| 95 | ** redefine _ERRORMESSAGE so that it won't need _ALERT. | 95 | ** redefine _ERRORMESSAGE so that it won't need _ALERT. |
| 96 | */ | 96 | */ |
| 97 | void luaB_alert (lua_State *L) { | 97 | void luaB__alert (lua_State *L) { |
| 98 | fputs(luaL_check_string(L, 1), stderr); | 98 | fputs(luaL_check_string(L, 1), stderr); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | /* | 102 | /* |
| 103 | ** Standard implementation of _ERRORMESSAGE. | 103 | ** Standard implementation of _ERRORMESSAGE. |
| 104 | ** The library "iolib" redefines _ERRORMESSAGE for better error information. | 104 | ** The library `liolib' redefines _ERRORMESSAGE for better error information. |
| 105 | */ | 105 | */ |
| 106 | void luaB_ERRORMESSAGE (lua_State *L) { | 106 | void luaB__ERRORMESSAGE (lua_State *L) { |
| 107 | lua_Object al = lua_rawgetglobal(L, "_ALERT"); | 107 | lua_Object al = lua_rawgetglobal(L, "_ALERT"); |
| 108 | if (lua_isfunction(L, al)) { /* avoid error loop if _ALERT is not defined */ | 108 | if (lua_isfunction(L, al)) { /* avoid error loop if _ALERT is not defined */ |
| 109 | char buff[600]; | 109 | char buff[600]; |
| @@ -529,7 +529,7 @@ static void swap (lua_State *L, Hash *a, int i, int j) { | |||
| 529 | 529 | ||
| 530 | static int sort_comp (lua_State *L, lua_Object f, const TObject *a, | 530 | static int sort_comp (lua_State *L, lua_Object f, const TObject *a, |
| 531 | const TObject *b) { | 531 | const TObject *b) { |
| 532 | /* notice: the caller (auxsort) must check stack space */ | 532 | /* WARNING: the caller (auxsort) must ensure stack space */ |
| 533 | if (f != LUA_NOOBJECT) { | 533 | if (f != LUA_NOOBJECT) { |
| 534 | *(L->top) = *f; | 534 | *(L->top) = *f; |
| 535 | *(L->top+1) = *a; | 535 | *(L->top+1) = *a; |
| @@ -609,8 +609,8 @@ void luaB_sort (lua_State *L) { | |||
| 609 | 609 | ||
| 610 | 610 | ||
| 611 | static const struct luaL_reg builtin_funcs[] = { | 611 | static const struct luaL_reg builtin_funcs[] = { |
| 612 | {"_ALERT", luaB_alert}, | 612 | {"_ALERT", luaB__alert}, |
| 613 | {"_ERRORMESSAGE", luaB_ERRORMESSAGE}, | 613 | {"_ERRORMESSAGE", luaB__ERRORMESSAGE}, |
| 614 | {"call", luaB_call}, | 614 | {"call", luaB_call}, |
| 615 | {"collectgarbage", luaB_collectgarbage}, | 615 | {"collectgarbage", luaB_collectgarbage}, |
| 616 | {"copytagmethods", luaB_copytagmethods}, | 616 | {"copytagmethods", luaB_copytagmethods}, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.h,v 1.2 1999/11/22 13:12:07 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.h,v 1.3 1999/12/14 18:33:29 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -9,8 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | #include "lua.h" | 10 | #include "lua.h" |
| 11 | 11 | ||
| 12 | void luaB_alert (lua_State *L); | 12 | void luaB__alert (lua_State *L); |
| 13 | void luaB_ERRORMESSAGE (lua_State *L); | 13 | void luaB__ERRORMESSAGE (lua_State *L); |
| 14 | void luaB_print (lua_State *L); | 14 | void luaB_print (lua_State *L); |
| 15 | void luaB_tonumber (lua_State *L); | 15 | void luaB_tonumber (lua_State *L); |
| 16 | void luaB_error (lua_State *L); | 16 | void luaB_error (lua_State *L); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.59 1999/12/21 18:04:41 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.60 1999/12/23 18:19:57 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -56,7 +56,7 @@ void luaD_checkstack (lua_State *L, int n) { | |||
| 56 | else { | 56 | else { |
| 57 | L->stack_last += EXTRA_STACK; /* to be used by error message */ | 57 | L->stack_last += EXTRA_STACK; /* to be used by error message */ |
| 58 | if (lua_stackedfunction(L, L->stacksize/SLOTS_PER_F) == LUA_NOOBJECT) { | 58 | if (lua_stackedfunction(L, L->stacksize/SLOTS_PER_F) == LUA_NOOBJECT) { |
| 59 | /* too few funcs on stack: doesn't look like a rec. loop */ | 59 | /* too few funcs on stack: doesn't look like a recursion loop */ |
| 60 | lua_error(L, "Lua2C - C2Lua overflow"); | 60 | lua_error(L, "Lua2C - C2Lua overflow"); |
| 61 | } | 61 | } |
| 62 | else | 62 | else |
| @@ -253,14 +253,14 @@ static void message (lua_State *L, const char *s) { | |||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /* | 255 | /* |
| 256 | ** Reports an error, and jumps up to the available recover label | 256 | ** Reports an error, and jumps up to the available recovery label |
| 257 | */ | 257 | */ |
| 258 | void lua_error (lua_State *L, const char *s) { | 258 | void lua_error (lua_State *L, const char *s) { |
| 259 | if (s) message(L, s); | 259 | if (s) message(L, s); |
| 260 | if (L->errorJmp) | 260 | if (L->errorJmp) |
| 261 | longjmp(L->errorJmp->b, 1); | 261 | longjmp(L->errorJmp->b, 1); |
| 262 | else { | 262 | else { |
| 263 | message(L, "exit(1). Unable to recover.\n"); | 263 | message(L, "unable to recover. exiting.\n"); |
| 264 | exit(1); | 264 | exit(1); |
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lfunc.c,v 1.14 1999/11/10 15:39:35 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 1.15 1999/11/22 13:12:07 roberto Exp roberto $ |
| 3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -61,7 +61,7 @@ void luaF_freeclosure (lua_State *L, Closure *c) { | |||
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | /* | 63 | /* |
| 64 | ** Look for n-th local variable at line "line" in function "func". | 64 | ** Look for n-th local variable at line `line' in function `func'. |
| 65 | ** Returns NULL if not found. | 65 | ** Returns NULL if not found. |
| 66 | */ | 66 | */ |
| 67 | const char *luaF_getlocalname (const TProtoFunc *func, | 67 | const char *luaF_getlocalname (const TProtoFunc *func, |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lfunc.h,v 1.8 1999/10/14 19:46:57 roberto Exp roberto $ | 2 | ** $Id: lfunc.h,v 1.9 1999/11/22 13:12:07 roberto Exp roberto $ |
| 3 | ** Lua Function structures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 1.37 1999/12/21 18:04:41 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.38 1999/12/23 18:19:57 roberto Exp roberto $ |
| 3 | ** Garbage Collector | 3 | ** Garbage Collector |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -181,7 +181,7 @@ static void clear_global_list (lua_State *L, int limit) { | |||
| 181 | ** with limit=MAX_INT, that means all elements. | 181 | ** with limit=MAX_INT, that means all elements. |
| 182 | */ | 182 | */ |
| 183 | static void collectstring (lua_State *L, int limit) { | 183 | static void collectstring (lua_State *L, int limit) { |
| 184 | TObject o; /* to call userdata 'gc' tag method */ | 184 | TObject o; /* to call userdata `gc' tag method */ |
| 185 | int i; | 185 | int i; |
| 186 | ttype(&o) = LUA_T_USERDATA; | 186 | ttype(&o) = LUA_T_USERDATA; |
| 187 | clear_global_list(L, limit); | 187 | clear_global_list(L, limit); |
| @@ -254,7 +254,7 @@ void luaC_collect (lua_State *L, int all) { | |||
| 254 | 254 | ||
| 255 | 255 | ||
| 256 | long lua_collectgarbage (lua_State *L, long limit) { | 256 | long lua_collectgarbage (lua_State *L, long limit) { |
| 257 | unsigned long recovered = L->nblocks; /* to subtract nblocks after gc */ | 257 | unsigned long recovered = L->nblocks; /* to subtract `nblocks' after gc */ |
| 258 | markall(L); | 258 | markall(L); |
| 259 | luaR_invalidaterefs(L); | 259 | luaR_invalidaterefs(L); |
| 260 | luaC_collect(L, 0); | 260 | luaC_collect(L, 0); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.h,v 1.14 1999/08/16 20:52:00 roberto Exp roberto $ | 2 | ** $Id: llex.h,v 1.15 1999/11/22 13:12:07 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #define FIRST_RESERVED 260 | 14 | #define FIRST_RESERVED 260 |
| 15 | 15 | ||
| 16 | /* maximum length of a reserved word (+1 for terminal 0) */ | 16 | /* maximum length of a reserved word (+1 for final 0) */ |
| 17 | #define TOKEN_LEN 15 | 17 | #define TOKEN_LEN 15 |
| 18 | 18 | ||
| 19 | 19 | ||
| @@ -34,7 +34,7 @@ enum RESERVED { | |||
| 34 | #define MAX_IFS 5 /* arbitrary limit */ | 34 | #define MAX_IFS 5 /* arbitrary limit */ |
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
| 37 | /* "ifstate" keeps the state of each nested $if the lexical is dealing with. */ | 37 | /* `ifState' keeps the state of each nested $if the lexical is dealing with. */ |
| 38 | 38 | ||
| 39 | struct ifState { | 39 | struct ifState { |
| 40 | int elsepart; /* true if it's in the $else part */ | 40 | int elsepart; /* true if it's in the $else part */ |
| @@ -46,7 +46,7 @@ struct ifState { | |||
| 46 | typedef struct LexState { | 46 | typedef struct LexState { |
| 47 | int current; /* look ahead character */ | 47 | int current; /* look ahead character */ |
| 48 | int token; /* look ahead token */ | 48 | int token; /* look ahead token */ |
| 49 | struct FuncState *fs; /* 'FuncState' is private for the parser */ | 49 | struct FuncState *fs; /* `FuncState' is private for the parser */ |
| 50 | struct lua_State *L; | 50 | struct lua_State *L; |
| 51 | union { | 51 | union { |
| 52 | real r; | 52 | real r; |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmathlib.c,v 1.21 1999/11/22 17:39:51 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.22 1999/12/14 18:31:20 roberto Exp roberto $ |
| 3 | ** Lua standard mathematical library | 3 | ** Standard mathematical library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -147,7 +147,7 @@ static void math_random (lua_State *L) { | |||
| 147 | some systems (SunOS!) "rand()" may return a value larger than RAND_MAX */ | 147 | some systems (SunOS!) "rand()" may return a value larger than RAND_MAX */ |
| 148 | double r = (double)(rand()%RAND_MAX) / (double)RAND_MAX; | 148 | double r = (double)(rand()%RAND_MAX) / (double)RAND_MAX; |
| 149 | if (lua_getparam(L, 1) == LUA_NOOBJECT) /* no arguments? */ | 149 | if (lua_getparam(L, 1) == LUA_NOOBJECT) /* no arguments? */ |
| 150 | lua_pushnumber(L, r); /* real between 0 & 1 */ | 150 | lua_pushnumber(L, r); /* real between 0 and 1 */ |
| 151 | else { | 151 | else { |
| 152 | int l, u; /* lower & upper limits */ | 152 | int l, u; /* lower & upper limits */ |
| 153 | if (lua_getparam(L, 2) == LUA_NOOBJECT) { /* only one argument? */ | 153 | if (lua_getparam(L, 2) == LUA_NOOBJECT) { /* only one argument? */ |
| @@ -159,7 +159,7 @@ static void math_random (lua_State *L) { | |||
| 159 | u = luaL_check_int(L, 2); | 159 | u = luaL_check_int(L, 2); |
| 160 | } | 160 | } |
| 161 | luaL_arg_check(L, l<=u, 1, "interval is empty"); | 161 | luaL_arg_check(L, l<=u, 1, "interval is empty"); |
| 162 | lua_pushnumber(L, (int)(r*(u-l+1))+l); /* integer between l & u */ | 162 | lua_pushnumber(L, (int)(r*(u-l+1))+l); /* integer between `l' and `u' */ |
| 163 | } | 163 | } |
| 164 | } | 164 | } |
| 165 | 165 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.c,v 1.21 1999/11/29 16:38:48 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.22 1999/12/14 18:31:20 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -49,7 +49,7 @@ void *luaM_realloc (lua_State *L, void *block, unsigned long size) { | |||
| 49 | if (s != size) | 49 | if (s != size) |
| 50 | lua_error(L, "memory allocation error: block too big"); | 50 | lua_error(L, "memory allocation error: block too big"); |
| 51 | if (size == 0) { | 51 | if (size == 0) { |
| 52 | free(block); /* block may be NULL, that is OK for free */ | 52 | free(block); /* block may be NULL; that is OK for free */ |
| 53 | return NULL; | 53 | return NULL; |
| 54 | } | 54 | } |
| 55 | block = realloc(block, s); | 55 | block = realloc(block, s); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.h,v 1.9 1999/08/16 20:52:00 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.10 1999/11/22 13:12:07 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -18,7 +18,7 @@ | |||
| 18 | #define refEM "reference table overflow" | 18 | #define refEM "reference table overflow" |
| 19 | #define tableEM "table overflow" | 19 | #define tableEM "table overflow" |
| 20 | #define memEM "not enough memory" | 20 | #define memEM "not enough memory" |
| 21 | #define arrEM "internal array bigger than `int' limit" | 21 | #define arrEM "internal array larger than `int' limit" |
| 22 | 22 | ||
| 23 | void *luaM_realloc (lua_State *L, void *oldblock, unsigned long size); | 23 | void *luaM_realloc (lua_State *L, void *oldblock, unsigned long size); |
| 24 | void *luaM_growaux (lua_State *L, void *block, unsigned long nelems, int inc, int size, | 24 | void *luaM_growaux (lua_State *L, void *block, unsigned long nelems, int inc, int size, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 1.40 1999/12/14 18:33:29 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.41 1999/12/23 18:19:57 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 | */ |
| @@ -46,7 +46,7 @@ typedef unsigned char Byte; /* unsigned 8 bits */ | |||
| 46 | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ | 46 | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | /* convertion of pointer to int (for hashing only) */ | 49 | /* conversion of pointer to int (for hashing only) */ |
| 50 | /* (the shift removes bits that are usually 0 because of alignment) */ | 50 | /* (the shift removes bits that are usually 0 because of alignment) */ |
| 51 | #define IntPoint(L, p) (((unsigned int)(p)) >> 3) | 51 | #define IntPoint(L, p) (((unsigned int)(p)) >> 3) |
| 52 | 52 | ||
| @@ -65,10 +65,10 @@ typedef unsigned char Byte; /* unsigned 8 bits */ | |||
| 65 | ** grep "ORDER LUA_T" | 65 | ** grep "ORDER LUA_T" |
| 66 | */ | 66 | */ |
| 67 | typedef enum { | 67 | typedef enum { |
| 68 | LUA_T_USERDATA = 0, /* tag default for userdata */ | 68 | LUA_T_USERDATA = 0, /* default tag for userdata */ |
| 69 | LUA_T_NUMBER = -1, /* fixed tag for numbers */ | 69 | LUA_T_NUMBER = -1, /* fixed tag for numbers */ |
| 70 | LUA_T_STRING = -2, /* fixed tag for strings */ | 70 | LUA_T_STRING = -2, /* fixed tag for strings */ |
| 71 | LUA_T_ARRAY = -3, /* tag default for tables (or arrays) */ | 71 | LUA_T_ARRAY = -3, /* default tag for tables (or arrays) */ |
| 72 | LUA_T_LPROTO = -4, /* fixed tag for Lua functions */ | 72 | LUA_T_LPROTO = -4, /* fixed tag for Lua functions */ |
| 73 | LUA_T_CPROTO = -5, /* fixed tag for C functions */ | 73 | LUA_T_CPROTO = -5, /* fixed tag for C functions */ |
| 74 | LUA_T_NIL = -6, /* last "pre-defined" tag */ | 74 | LUA_T_NIL = -6, /* last "pre-defined" tag */ |
| @@ -84,7 +84,7 @@ typedef enum { | |||
| 84 | #define NUM_TAGS 7 | 84 | #define NUM_TAGS 7 |
| 85 | 85 | ||
| 86 | /* | 86 | /* |
| 87 | ** chech whether t is a mark; ttypes are negative numbers, so the | 87 | ** chech whether `t' is a mark; ttypes are negative numbers, so the |
| 88 | ** comparisons look reversed. (ORDER LUA_T) | 88 | ** comparisons look reversed. (ORDER LUA_T) |
| 89 | */ | 89 | */ |
| 90 | #define is_T_MARK(t) (LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK) | 90 | #define is_T_MARK(t) (LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK) |
| @@ -181,7 +181,7 @@ typedef struct LocVar { | |||
| 181 | typedef struct Closure { | 181 | typedef struct Closure { |
| 182 | struct Closure *next; | 182 | struct Closure *next; |
| 183 | int marked; | 183 | int marked; |
| 184 | int nelems; /* not included the first one (always the prototype) */ | 184 | int nelems; /* not including the first one (always the prototype) */ |
| 185 | TObject consts[1]; /* at least one for prototype */ | 185 | TObject consts[1]; /* at least one for prototype */ |
| 186 | } Closure; | 186 | } Closure; |
| 187 | 187 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.33 1999/06/17 17:04:03 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.34 1999/11/25 18:59:43 roberto Exp roberto $ |
| 3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -121,7 +121,7 @@ LONGARG /* b (add b*(1<<16) to arg of next instruction) */ | |||
| 121 | #define MAX_ARG ((1<<24)-1) | 121 | #define MAX_ARG ((1<<24)-1) |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | /* maximum value of a word of 2 bytes; cannot be bigger than MAX_ARG */ | 124 | /* maximum value of a word of 2 bytes; cannot be larger than MAX_ARG */ |
| 125 | #if MAX_ARG < (1<<16) | 125 | #if MAX_ARG < (1<<16) |
| 126 | #define MAX_WORD MAX_ARG | 126 | #define MAX_WORD MAX_ARG |
| 127 | #else | 127 | #else |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lref.c,v 1.4 1999/12/14 18:31:20 roberto Exp roberto $ | 2 | ** $Id: lref.c,v 1.5 1999/12/23 18:19:57 roberto Exp roberto $ |
| 3 | ** REF mechanism | 3 | ** reference mechanism |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lref.h,v 1.3 1999/11/22 13:12:07 roberto Exp roberto $ | 2 | ** $Id: lref.h,v 1.4 1999/12/14 18:33:29 roberto Exp roberto $ |
| 3 | ** REF mechanism | 3 | ** reference mechanism |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.h,v 1.25 1999/12/06 11:41:28 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.26 1999/12/21 18:04:41 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 | */ |
| @@ -19,7 +19,7 @@ typedef TObject *StkId; /* index to stack elements */ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | ** "jmp_buf" may be an array, so it is better to make sure it has an | 22 | ** `jmp_buf' may be an array, so it is better to make sure it has an |
| 23 | ** address (and not that it *is* an address...) | 23 | ** address (and not that it *is* an address...) |
| 24 | */ | 24 | */ |
| 25 | struct lua_longjmp { | 25 | struct lua_longjmp { |
| @@ -74,7 +74,7 @@ struct lua_State { | |||
| 74 | int refSize; /* size of refArray */ | 74 | int refSize; /* size of refArray */ |
| 75 | int refFree; /* list of free positions in refArray */ | 75 | int refFree; /* list of free positions in refArray */ |
| 76 | unsigned long GCthreshold; | 76 | unsigned long GCthreshold; |
| 77 | unsigned long nblocks; /* number of 'blocks' currently allocated */ | 77 | unsigned long nblocks; /* number of `blocks' currently allocated */ |
| 78 | int debug; | 78 | int debug; |
| 79 | lua_CHFunction callhook; | 79 | lua_CHFunction callhook; |
| 80 | lua_LHFunction linehook; | 80 | lua_LHFunction linehook; |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstrlib.c,v 1.37 1999/11/22 13:12:07 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.38 1999/11/22 17:39:51 roberto Exp roberto $ |
| 3 | ** Standard library for strings and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.1 1999/12/14 18:31:20 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.2 1999/12/23 18:19:57 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -163,7 +163,7 @@ static void testC (lua_State *L) { | |||
| 163 | } | 163 | } |
| 164 | else if EQ("getparam") { | 164 | else if EQ("getparam") { |
| 165 | int n = getreg(L, &pc); | 165 | int n = getreg(L, &pc); |
| 166 | reg[n] = lua_getparam(L, getnum(&pc)+1); /* skips the commmand itself */ | 166 | reg[n] = lua_getparam(L, getnum(&pc)+1); /* skips the command itself */ |
| 167 | } | 167 | } |
| 168 | else if EQ("getresult") { | 168 | else if EQ("getresult") { |
| 169 | int n = getreg(L, &pc); | 169 | int n = getreg(L, &pc); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.74 1999/12/21 18:04:41 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.75 1999/12/23 18:19:57 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -135,21 +135,21 @@ void luaV_gettable (lua_State *L) { | |||
| 135 | */ | 135 | */ |
| 136 | void luaV_settable (lua_State *L, StkId t) { | 136 | void luaV_settable (lua_State *L, StkId t) { |
| 137 | const TObject *im; | 137 | const TObject *im; |
| 138 | if (ttype(t) != LUA_T_ARRAY) { /* not a table, get "settable" method */ | 138 | if (ttype(t) != LUA_T_ARRAY) { /* not a table, get `settable' method */ |
| 139 | im = luaT_getimbyObj(L, t, IM_SETTABLE); | 139 | im = luaT_getimbyObj(L, t, IM_SETTABLE); |
| 140 | if (ttype(im) == LUA_T_NIL) | 140 | if (ttype(im) == LUA_T_NIL) |
| 141 | lua_error(L, "indexed expression not a table"); | 141 | lua_error(L, "indexed expression not a table"); |
| 142 | } | 142 | } |
| 143 | else { /* object is a table... */ | 143 | else { /* object is a table... */ |
| 144 | im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE); | 144 | im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE); |
| 145 | if (ttype(im) == LUA_T_NIL) { /* and does not have a "settable" method */ | 145 | if (ttype(im) == LUA_T_NIL) { /* and does not have a `settable' method */ |
| 146 | luaH_set(L, avalue(t), t+1, L->top-1); | 146 | luaH_set(L, avalue(t), t+1, L->top-1); |
| 147 | L->top--; /* pop value */ | 147 | L->top--; /* pop value */ |
| 148 | return; | 148 | return; |
| 149 | } | 149 | } |
| 150 | /* else it has a "settable" method, go through to next command */ | 150 | /* else it has a `settable' method, go through to next command */ |
| 151 | } | 151 | } |
| 152 | /* object is not a table, or it has a "settable" method */ | 152 | /* object is not a table, or it has a `settable' method */ |
| 153 | /* prepare arguments and call the tag method */ | 153 | /* prepare arguments and call the tag method */ |
| 154 | *(L->top+1) = *(L->top-1); | 154 | *(L->top+1) = *(L->top-1); |
| 155 | *(L->top) = *(t+1); | 155 | *(L->top) = *(t+1); |
| @@ -210,7 +210,7 @@ static void call_binTM (lua_State *L, StkId top, IMS event, const char *msg) { | |||
| 210 | if (ttype(im) == LUA_T_NIL) { | 210 | if (ttype(im) == LUA_T_NIL) { |
| 211 | im = luaT_getimbyObj(L, top-1, event); /* try second operand */ | 211 | im = luaT_getimbyObj(L, top-1, event); /* try second operand */ |
| 212 | if (ttype(im) == LUA_T_NIL) { | 212 | if (ttype(im) == LUA_T_NIL) { |
| 213 | im = luaT_getim(L, 0, event); /* try a 'global' i.m. */ | 213 | im = luaT_getim(L, 0, event); /* try a `global' method */ |
| 214 | if (ttype(im) == LUA_T_NIL) | 214 | if (ttype(im) == LUA_T_NIL) |
| 215 | lua_error(L, msg); | 215 | lua_error(L, msg); |
| 216 | } | 216 | } |
| @@ -603,7 +603,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, | |||
| 603 | case LONGARGW: aux += highbyte(L, *pc++); | 603 | case LONGARGW: aux += highbyte(L, *pc++); |
| 604 | case LONGARG: aux += *pc++; | 604 | case LONGARG: aux += *pc++; |
| 605 | aux = highbyte(L, highbyte(L, aux)); | 605 | aux = highbyte(L, highbyte(L, aux)); |
| 606 | goto switchentry; /* do not reset "aux" */ | 606 | goto switchentry; /* do not reset `aux' */ |
| 607 | 607 | ||
| 608 | } | 608 | } |
| 609 | } | 609 | } |
