aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-06-24 10:33:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-06-24 10:33:00 -0300
commit468fbdbde749d5fe221adebf115f9594067b8da4 (patch)
tree675a310082a7fa86af2818c49606060d1c422a97
parenteb45f8b63166ac06330dbbd2b7c9224e4db9e2ca (diff)
downloadlua-468fbdbde749d5fe221adebf115f9594067b8da4.tar.gz
lua-468fbdbde749d5fe221adebf115f9594067b8da4.tar.bz2
lua-468fbdbde749d5fe221adebf115f9594067b8da4.zip
details
-rw-r--r--lstate.h10
-rw-r--r--lstrlib.c8
2 files changed, 11 insertions, 7 deletions
diff --git a/lstate.h b/lstate.h
index 303349f0..129dc43b 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.9 1998/06/02 20:37:04 roberto Exp roberto $ 2** $Id: lstate.h,v 1.10 1998/06/19 16:14:09 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*/
@@ -7,6 +7,8 @@
7#ifndef lstate_h 7#ifndef lstate_h
8#define lstate_h 8#define lstate_h
9 9
10#include <setjmp.h>
11
10#include "lobject.h" 12#include "lobject.h"
11#include "lua.h" 13#include "lua.h"
12 14
@@ -39,9 +41,11 @@ typedef struct {
39} stringtable; 41} stringtable;
40 42
41 43
44enum Status {LOCK, HOLD, FREE, COLLECTED};
45
42struct ref { 46struct ref {
43 TObject o; 47 TObject o;
44 enum {LOCK, HOLD, FREE, COLLECTED} status; 48 enum Status status;
45}; 49};
46 50
47 51
@@ -49,7 +53,7 @@ struct lua_State {
49 /* thread-specific state */ 53 /* thread-specific state */
50 struct Stack stack; /* Lua stack */ 54 struct Stack stack; /* Lua stack */
51 struct C_Lua_Stack Cstack; /* C2lua struct */ 55 struct C_Lua_Stack Cstack; /* C2lua struct */
52 void *errorJmp; /* current error recover point */ 56 jmp_buf *errorJmp; /* current error recover point */
53 char *Mbuffer; /* global buffer */ 57 char *Mbuffer; /* global buffer */
54 char *Mbuffbase; /* current first position of Mbuffer */ 58 char *Mbuffbase; /* current first position of Mbuffer */
55 int Mbuffsize; /* size of Mbuffer */ 59 int Mbuffsize; /* size of Mbuffer */
diff --git a/lstrlib.c b/lstrlib.c
index 58fbd708..72188723 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.14 1998/05/31 22:20:45 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.15 1998/06/19 16:14:09 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*/
@@ -302,19 +302,19 @@ static char *match (char *s, char *p, struct Capture *cap)
302 switch (*ep) { 302 switch (*ep) {
303 case '*': { /* repetition */ 303 case '*': { /* repetition */
304 char *res; 304 char *res;
305 if (s1 && s1>s && (res = match(s1, p, cap))) 305 if (s1 && s1>s && ((res=match(s1, p, cap)) != NULL))
306 return res; 306 return res;
307 p=ep+1; goto init; /* else return match(s, ep+1, cap); */ 307 p=ep+1; goto init; /* else return match(s, ep+1, cap); */
308 } 308 }
309 case '?': { /* optional */ 309 case '?': { /* optional */
310 char *res; 310 char *res;
311 if (s1 && (res = match(s1, ep+1, cap))) 311 if (s1 && ((res=match(s1, ep+1, cap)) != NULL))
312 return res; 312 return res;
313 p=ep+1; goto init; /* else return match(s, ep+1, cap); */ 313 p=ep+1; goto init; /* else return match(s, ep+1, cap); */
314 } 314 }
315 case '-': { /* repetition */ 315 case '-': { /* repetition */
316 char *res; 316 char *res;
317 if ((res = match(s, ep+1, cap)) != 0) 317 if ((res = match(s, ep+1, cap)) != NULL)
318 return res; 318 return res;
319 else if (s1 && s1>s) { 319 else if (s1 && s1>s) {
320 s = s1; 320 s = s1;