aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lapi.c10
-rw-r--r--lgc.c6
-rw-r--r--llex.c11
-rw-r--r--lobject.c4
-rw-r--r--lstrlib.c30
-rw-r--r--ltable.c10
6 files changed, 36 insertions, 35 deletions
diff --git a/lapi.c b/lapi.c
index 63e6dbfd..edce0266 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.17 1998/01/02 17:46:32 roberto Exp roberto $ 2** $Id: lapi.c,v 1.18 1998/01/07 16:26:48 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*/
@@ -39,12 +39,12 @@ static int normalized_type (TObject *o)
39{ 39{
40 int t = ttype(o); 40 int t = ttype(o);
41 switch (t) { 41 switch (t) {
42 case LUA_T_CLMARK:
43 return LUA_T_CLOSURE;
44 case LUA_T_PMARK: 42 case LUA_T_PMARK:
45 return LUA_T_PROTO; 43 return LUA_T_PROTO;
46 case LUA_T_CMARK: 44 case LUA_T_CMARK:
47 return LUA_T_CPROTO; 45 return LUA_T_CPROTO;
46 case LUA_T_CLMARK:
47 return LUA_T_CLOSURE;
48 default: 48 default:
49 return t; 49 return t;
50 } 50 }
@@ -382,12 +382,12 @@ int lua_tag (lua_Object lo)
382 return o->value.ts->u.d.tag; 382 return o->value.ts->u.d.tag;
383 case LUA_T_ARRAY: 383 case LUA_T_ARRAY:
384 return o->value.a->htag; 384 return o->value.a->htag;
385 case LUA_T_CLOSURE: case LUA_T_CLMARK:
386 return o->value.cl->consts[0].ttype;
387 case LUA_T_PMARK: 385 case LUA_T_PMARK:
388 return LUA_T_PROTO; 386 return LUA_T_PROTO;
389 case LUA_T_CMARK: 387 case LUA_T_CMARK:
390 return LUA_T_CPROTO; 388 return LUA_T_CPROTO;
389 case LUA_T_CLOSURE: case LUA_T_CLMARK:
390 return o->value.cl->consts[0].ttype;
391#ifdef DEBUG 391#ifdef DEBUG
392 case LUA_T_LINE: 392 case LUA_T_LINE:
393 lua_error("internal error"); 393 lua_error("internal error");
diff --git a/lgc.c b/lgc.c
index c5a99e62..38cc50d3 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.13 1997/12/15 16:17:20 roberto Exp roberto $ 2** $Id: lgc.c,v 1.14 1997/12/17 20:48:58 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*/
@@ -87,12 +87,12 @@ static int ismarked (TObject *o)
87 switch (o->ttype) { 87 switch (o->ttype) {
88 case LUA_T_STRING: case LUA_T_USERDATA: 88 case LUA_T_STRING: case LUA_T_USERDATA:
89 return o->value.ts->head.marked; 89 return o->value.ts->head.marked;
90 case LUA_T_ARRAY:
91 return o->value.a->head.marked;
90 case LUA_T_CLOSURE: 92 case LUA_T_CLOSURE:
91 return o->value.cl->head.marked; 93 return o->value.cl->head.marked;
92 case LUA_T_PROTO: 94 case LUA_T_PROTO:
93 return o->value.tf->head.marked; 95 return o->value.tf->head.marked;
94 case LUA_T_ARRAY:
95 return o->value.a->head.marked;
96#ifdef DEBUG 96#ifdef DEBUG
97 case LUA_T_LINE: case LUA_T_CLMARK: 97 case LUA_T_LINE: case LUA_T_CLMARK:
98 case LUA_T_CMARK: case LUA_T_PMARK: 98 case LUA_T_CMARK: case LUA_T_PMARK:
diff --git a/llex.c b/llex.c
index a246aff9..3e647b10 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.11 1997/12/17 20:48:58 roberto Exp roberto $ 2** $Id: llex.c,v 1.12 1997/12/22 17:52:20 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*/
@@ -268,15 +268,16 @@ int luaY_lex (YYSTYPE *l)
268 LS->linelasttoken = LS->linenumber; 268 LS->linelasttoken = LS->linenumber;
269 while (1) { 269 while (1) {
270 switch (LS->current) { 270 switch (LS->current) {
271 case '\n':
272 inclinenumber(LS);
273 LS->linelasttoken = LS->linenumber;
274 continue;
275 271
276 case ' ': case '\t': case '\r': /* CR: to avoid problems with DOS */ 272 case ' ': case '\t': case '\r': /* CR: to avoid problems with DOS */
277 next(LS); 273 next(LS);
278 continue; 274 continue;
279 275
276 case '\n':
277 inclinenumber(LS);
278 LS->linelasttoken = LS->linenumber;
279 continue;
280
280 case '-': 281 case '-':
281 save_and_next(LS); 282 save_and_next(LS);
282 if (LS->current != '-') return '-'; 283 if (LS->current != '-') return '-';
diff --git a/lobject.c b/lobject.c
index a8c74c7f..981e236e 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.8 1997/12/15 16:17:20 roberto Exp roberto $ 2** $Id: lobject.c,v 1.9 1997/12/26 18:38:16 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -48,9 +48,9 @@ int luaO_equalObj (TObject *t1, TObject *t2)
48 case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2); 48 case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2);
49 case LUA_T_STRING: case LUA_T_USERDATA: return svalue(t1) == svalue(t2); 49 case LUA_T_STRING: case LUA_T_USERDATA: return svalue(t1) == svalue(t2);
50 case LUA_T_ARRAY: return avalue(t1) == avalue(t2); 50 case LUA_T_ARRAY: return avalue(t1) == avalue(t2);
51 case LUA_T_CLOSURE: return t1->value.cl == t2->value.cl;
52 case LUA_T_PROTO: return tfvalue(t1) == tfvalue(t2); 51 case LUA_T_PROTO: return tfvalue(t1) == tfvalue(t2);
53 case LUA_T_CPROTO: return fvalue(t1) == fvalue(t2); 52 case LUA_T_CPROTO: return fvalue(t1) == fvalue(t2);
53 case LUA_T_CLOSURE: return t1->value.cl == t2->value.cl;
54 default: 54 default:
55 lua_error("internal error in `lua_equalObj'"); 55 lua_error("internal error in `lua_equalObj'");
56 return 0; /* UNREACHEABLE */ 56 return 0; /* UNREACHEABLE */
diff --git a/lstrlib.c b/lstrlib.c
index cca70bc5..34b9da42 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.4 1997/12/15 17:58:49 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.5 1997/12/17 20:48:58 roberto Exp roberto $
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*/
@@ -165,14 +165,14 @@ static int matchclass (int c, int cl)
165 int res; 165 int res;
166 if (c == 0) return 0; 166 if (c == 0) return 0;
167 switch (tolower((unsigned char)cl)) { 167 switch (tolower((unsigned char)cl)) {
168 case 'a' : res = isalpha((unsigned char)c); break; 168 case 'w' : res = isalnum((unsigned char)c); break;
169 case 'c' : res = iscntrl((unsigned char)c); break;
170 case 'd' : res = isdigit((unsigned char)c); break; 169 case 'd' : res = isdigit((unsigned char)c); break;
171 case 'l' : res = islower((unsigned char)c); break;
172 case 'p' : res = ispunct((unsigned char)c); break;
173 case 's' : res = isspace((unsigned char)c); break; 170 case 's' : res = isspace((unsigned char)c); break;
171 case 'a' : res = isalpha((unsigned char)c); break;
172 case 'p' : res = ispunct((unsigned char)c); break;
173 case 'l' : res = islower((unsigned char)c); break;
174 case 'u' : res = isupper((unsigned char)c); break; 174 case 'u' : res = isupper((unsigned char)c); break;
175 case 'w' : res = isalnum((unsigned char)c); break; 175 case 'c' : res = iscntrl((unsigned char)c); break;
176 default: return (cl == c); 176 default: return (cl == c);
177 } 177 }
178 return (islower((unsigned char)cl) ? res : !res); 178 return (islower((unsigned char)cl) ? res : !res);
@@ -182,12 +182,12 @@ static int matchclass (int c, int cl)
182int luaI_singlematch (int c, char *p, char **ep) 182int luaI_singlematch (int c, char *p, char **ep)
183{ 183{
184 switch (*p) { 184 switch (*p) {
185 case '\0':
186 *ep = p;
187 return 0;
188 case '.': 185 case '.':
189 *ep = p+1; 186 *ep = p+1;
190 return (c != 0); 187 return (c != 0);
188 case '\0':
189 *ep = p;
190 return 0;
191 case ESC: 191 case ESC:
192 if (*(++p) == '\0') 192 if (*(++p) == '\0')
193 luaL_verror("incorrect pattern (ends with `%c')", ESC); 193 luaL_verror("incorrect pattern (ends with `%c')", ESC);
@@ -294,6 +294,12 @@ static char *match (char *s, char *p, struct Capture *cap)
294 return res; 294 return res;
295 p=ep+1; goto init; /* else return match(s, ep+1, cap); */ 295 p=ep+1; goto init; /* else return match(s, ep+1, cap); */
296 } 296 }
297 case '?': { /* optional */
298 char *res;
299 if (s1 && (res = match(s1, ep+1, cap)))
300 return res;
301 p=ep+1; goto init; /* else return match(s, ep+1, cap); */
302 }
297 case '-': { /* repetition */ 303 case '-': { /* repetition */
298 char *res; 304 char *res;
299 if ((res = match(s, ep+1, cap)) != 0) 305 if ((res = match(s, ep+1, cap)) != 0)
@@ -305,12 +311,6 @@ static char *match (char *s, char *p, struct Capture *cap)
305 else 311 else
306 return NULL; 312 return NULL;
307 } 313 }
308 case '?': { /* optional */
309 char *res;
310 if (s1 && (res = match(s1, ep+1, cap)))
311 return res;
312 p=ep+1; goto init; /* else return match(s, ep+1, cap); */
313 }
314 default: 314 default:
315 if (s1) { s=s1; p=ep; goto init; } /* return match(s1, ep, cap); */ 315 if (s1) { s=s1; p=ep; goto init; } /* return match(s1, ep, cap); */
316 else return NULL; 316 else return NULL;
diff --git a/ltable.c b/ltable.c
index f182e4ba..0c91833a 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.8 1997/12/09 13:35:19 roberto Exp roberto $ 2** $Id: ltable.c,v 1.9 1997/12/15 16:17:20 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -36,8 +36,8 @@ static long int hashindex (TObject *ref)
36 case LUA_T_STRING: case LUA_T_USERDATA: 36 case LUA_T_STRING: case LUA_T_USERDATA:
37 h = (IntPoint)tsvalue(ref); 37 h = (IntPoint)tsvalue(ref);
38 break; 38 break;
39 case LUA_T_CLOSURE: 39 case LUA_T_ARRAY:
40 h = (IntPoint)clvalue(ref); 40 h = (IntPoint)avalue(ref);
41 break; 41 break;
42 case LUA_T_PROTO: 42 case LUA_T_PROTO:
43 h = (IntPoint)tfvalue(ref); 43 h = (IntPoint)tfvalue(ref);
@@ -45,8 +45,8 @@ static long int hashindex (TObject *ref)
45 case LUA_T_CPROTO: 45 case LUA_T_CPROTO:
46 h = (IntPoint)fvalue(ref); 46 h = (IntPoint)fvalue(ref);
47 break; 47 break;
48 case LUA_T_ARRAY: 48 case LUA_T_CLOSURE:
49 h = (IntPoint)avalue(ref); 49 h = (IntPoint)clvalue(ref);
50 break; 50 break;
51 default: 51 default:
52 lua_error("unexpected type to index table"); 52 lua_error("unexpected type to index table");