Browse Source

better encapsulation of some types

Roberto Ierusalimschy 24 years ago
parent
commit
52ee91dd73
10 changed files with 83 additions and 64 deletions
  1. 2 2
      lbaselib.c
  2. 2 5
      ldo.c
  3. 3 3
      liolib.c
  4. 3 3
      llex.c
  5. 11 1
      llimits.h
  6. 2 2
      lobject.c
  7. 2 2
      lstring.c
  8. 36 36
      lstrlib.c
  9. 10 9
      lua.h
  10. 12 1
      lualib.h

+ 2 - 2
lbaselib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lbaselib.c,v 1.23 2001/02/09 19:52:24 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.24 2001/02/20 18:29:54 roberto Exp roberto $
 ** Basic library
 ** Basic library
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -100,7 +100,7 @@ static int luaB_tonumber (lua_State *L) {
     luaL_arg_check(L, 2 <= base && base <= 36, 2, "base out of range");
     luaL_arg_check(L, 2 <= base && base <= 36, 2, "base out of range");
     n = strtoul(s1, &s2, base);
     n = strtoul(s1, &s2, base);
     if (s1 != s2) {  /* at least one valid digit? */
     if (s1 != s2) {  /* at least one valid digit? */
-      while (isspace((unsigned char)*s2)) s2++;  /* skip trailing spaces */
+      while (isspace(uchar(*s2))) s2++;  /* skip trailing spaces */
       if (*s2 == '\0') {  /* no invalid trailing characters? */
       if (*s2 == '\0') {  /* no invalid trailing characters? */
         lua_pushnumber(L, n);
         lua_pushnumber(L, n);
         return 1;
         return 1;

+ 2 - 5
ldo.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.c,v 1.123 2001/02/07 18:13:49 roberto Exp roberto $
+** $Id: ldo.c,v 1.124 2001/02/20 18:15:33 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -265,12 +265,9 @@ static int parse_file (lua_State *L, const char *filename) {
   ZIO z;
   ZIO z;
   int status;
   int status;
   int bin;  /* flag for file mode */
   int bin;  /* flag for file mode */
-  int c;    /* look ahead char */
   FILE *f = (filename == NULL) ? stdin : fopen(filename, "r");
   FILE *f = (filename == NULL) ? stdin : fopen(filename, "r");
   if (f == NULL) return LUA_ERRFILE;  /* unable to open file */
   if (f == NULL) return LUA_ERRFILE;  /* unable to open file */
-  c = fgetc(f);
-  ungetc(c, f);
-  bin = (c == ID_CHUNK);
+  bin = (ungetc(fgetc(f), f) == ID_CHUNK);
   if (bin && f != stdin) {
   if (bin && f != stdin) {
     fclose(f);
     fclose(f);
     f = fopen(filename, "rb");  /* reopen in binary mode */
     f = fopen(filename, "rb");  /* reopen in binary mode */

+ 3 - 3
liolib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: liolib.c,v 1.105 2001/02/09 16:25:50 roberto Exp roberto $
+** $Id: liolib.c,v 1.106 2001/02/09 19:52:54 roberto Exp roberto $
 ** Standard I/O (and system) library
 ** Standard I/O (and system) library
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -214,7 +214,7 @@ static int read_number (lua_State *L, FILE *f) {
 
 
 
 
 static int read_word (lua_State *L, FILE *f) {
 static int read_word (lua_State *L, FILE *f) {
-  int c;
+  l_charint c;
   luaL_Buffer b;
   luaL_Buffer b;
   luaL_buffinit(L, &b);
   luaL_buffinit(L, &b);
   do { c = fgetc(f); } while (isspace(c));  /* skip spaces */
   do { c = fgetc(f); } while (isspace(c));  /* skip spaces */
@@ -273,7 +273,7 @@ static void read_file (lua_State *L, FILE *f) {
 
 
 static int read_chars (lua_State *L, FILE *f, size_t n) {
 static int read_chars (lua_State *L, FILE *f, size_t n) {
   if (n == 0) {  /* test eof? */
   if (n == 0) {  /* test eof? */
-    int c = fgetc(f);
+    l_charint c = fgetc(f);
     ungetc(c, f);
     ungetc(c, f);
     lua_pushlstring(L, NULL, 0);
     lua_pushlstring(L, NULL, 0);
     return (c != EOF);
     return (c != EOF);

+ 3 - 3
llex.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: llex.c,v 1.76 2001/01/19 13:20:30 roberto Exp roberto $
+** $Id: llex.c,v 1.77 2001/02/09 20:22:29 roberto Exp roberto $
 ** Lexical Analyzer
 ** Lexical Analyzer
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -36,7 +36,7 @@ void luaX_init (lua_State *L) {
   for (i=0; i<NUM_RESERVED; i++) {
   for (i=0; i<NUM_RESERVED; i++) {
     TString *ts = luaS_new(L, token2string[i]);
     TString *ts = luaS_new(L, token2string[i]);
     lua_assert(strlen(token2string[i])+1 <= TOKEN_LEN);
     lua_assert(strlen(token2string[i])+1 <= TOKEN_LEN);
-    ts->marked = (unsigned char)(RESERVEDMARK+i);  /* reserved word */
+    ts->marked = RESERVEDMARK+i;  /* reserved word */
   }
   }
 }
 }
 
 
@@ -255,7 +255,7 @@ static void read_string (LexState *LS, int del, SemInfo *seminfo) {
               c = 10*c + (LS->current-'0');
               c = 10*c + (LS->current-'0');
               next(LS);
               next(LS);
             } while (++i<3 && isdigit(LS->current));
             } while (++i<3 && isdigit(LS->current));
-            if (c != (unsigned char)c) {
+            if (c > UCHAR_MAX) {
               save(L, '\0', l);
               save(L, '\0', l);
               luaX_error(LS, "escape sequence too large", TK_STRING);
               luaX_error(LS, "escape sequence too large", TK_STRING);
             }
             }

+ 11 - 1
llimits.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: llimits.h,v 1.22 2001/02/09 16:24:44 roberto Exp roberto $
+** $Id: llimits.h,v 1.23 2001/02/20 18:15:33 roberto Exp roberto $
 ** Limits, basic types, and some other "installation-dependent" definitions
 ** Limits, basic types, and some other "installation-dependent" definitions
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -32,11 +32,17 @@
 
 
 
 
 /* function to convert a lua_Number to a string */
 /* function to convert a lua_Number to a string */
+#ifndef NUMBER_FMT
 #define NUMBER_FMT	"%.16g"		/* LUA_NUMBER */
 #define NUMBER_FMT	"%.16g"		/* LUA_NUMBER */
+#endif
+#ifndef lua_number2str
 #define lua_number2str(s,n)	sprintf((s), NUMBER_FMT, (n))
 #define lua_number2str(s,n)	sprintf((s), NUMBER_FMT, (n))
+#endif
 
 
 /* function to convert a string to a lua_Number */
 /* function to convert a string to a lua_Number */
+#ifndef lua_str2number
 #define lua_str2number(s,p)	strtod((s), (p))
 #define lua_str2number(s,p)	strtod((s), (p))
+#endif
 
 
 
 
 
 
@@ -63,6 +69,10 @@ typedef long ls_nstr;
 typedef unsigned char lu_byte;
 typedef unsigned char lu_byte;
 
 
 
 
+/* macro to `unsign' a character */
+#define uchar(c)        ((unsigned char)(c))
+
+
 #define MAX_SIZET	((size_t)(~(size_t)0)-2)
 #define MAX_SIZET	((size_t)(~(size_t)0)-2)
 
 
 
 

+ 2 - 2
lobject.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lobject.c,v 1.64 2001/02/02 15:13:05 roberto Exp roberto $
+** $Id: lobject.c,v 1.65 2001/02/20 18:15:33 roberto Exp roberto $
 ** Some generic functions over Lua objects
 ** Some generic functions over Lua objects
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -48,7 +48,7 @@ int luaO_str2d (const char *s, lua_Number *result) {  /* LUA_NUMBER */
   char *endptr;
   char *endptr;
   lua_Number res = lua_str2number(s, &endptr);
   lua_Number res = lua_str2number(s, &endptr);
   if (endptr == s) return 0;  /* no conversion */
   if (endptr == s) return 0;  /* no conversion */
-  while (isspace((unsigned char)*endptr)) endptr++;
+  while (isspace(uchar(*endptr))) endptr++;
   if (*endptr != '\0') return 0;  /* invalid trailing characters? */
   if (*endptr != '\0') return 0;  /* invalid trailing characters? */
   *result = res;
   *result = res;
   return 1;
   return 1;

+ 2 - 2
lstring.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lstring.c,v 1.58 2001/02/09 20:29:33 roberto Exp roberto $
+** $Id: lstring.c,v 1.59 2001/02/20 18:15:33 roberto Exp roberto $
 ** String table (keeps all strings handled by Lua)
 ** String table (keeps all strings handled by Lua)
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -69,7 +69,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
   size_t step = (l>>5)+1;  /* if string is too long, don't hash all its chars */
   size_t step = (l>>5)+1;  /* if string is too long, don't hash all its chars */
   size_t l1;
   size_t l1;
   for (l1=l; l1>=step; l1-=step)  /* compute hash */
   for (l1=l; l1>=step; l1-=step)  /* compute hash */
-    h = h ^ ((h<<5)+(h>>2)+(unsigned char)str[l1-1]);
+    h = h ^ ((h<<5)+(h>>2)+uchar(str[l1-1]));
   for (ts = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; ts; ts = ts->nexthash) {
   for (ts = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; ts; ts = ts->nexthash) {
     if (ts->len == l && (memcmp(str, getstr(ts), l) == 0))
     if (ts->len == l && (memcmp(str, getstr(ts), l) == 0))
       return ts;
       return ts;

+ 36 - 36
lstrlib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lstrlib.c,v 1.61 2001/01/10 16:58:11 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.62 2001/02/02 19:02:40 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -55,7 +55,7 @@ static int str_lower (lua_State *L) {
   const char *s = luaL_check_lstr(L, 1, &l);
   const char *s = luaL_check_lstr(L, 1, &l);
   luaL_buffinit(L, &b);
   luaL_buffinit(L, &b);
   for (i=0; i<l; i++)
   for (i=0; i<l; i++)
-    luaL_putchar(&b, tolower((unsigned char)(s[i])));
+    luaL_putchar(&b, tolower(uchar(s[i])));
   luaL_pushresult(&b);
   luaL_pushresult(&b);
   return 1;
   return 1;
 }
 }
@@ -68,7 +68,7 @@ static int str_upper (lua_State *L) {
   const char *s = luaL_check_lstr(L, 1, &l);
   const char *s = luaL_check_lstr(L, 1, &l);
   luaL_buffinit(L, &b);
   luaL_buffinit(L, &b);
   for (i=0; i<l; i++)
   for (i=0; i<l; i++)
-    luaL_putchar(&b, toupper((unsigned char)(s[i])));
+    luaL_putchar(&b, toupper(uchar(s[i])));
   luaL_pushresult(&b);
   luaL_pushresult(&b);
   return 1;
   return 1;
 }
 }
@@ -91,7 +91,7 @@ static int str_byte (lua_State *L) {
   const char *s = luaL_check_lstr(L, 1, &l);
   const char *s = luaL_check_lstr(L, 1, &l);
   sint32 pos = posrelat(luaL_opt_long(L, 2, 1), l);
   sint32 pos = posrelat(luaL_opt_long(L, 2, 1), l);
   luaL_arg_check(L, 0<pos && (size_t)pos<=l, 2,  "out of range");
   luaL_arg_check(L, 0<pos && (size_t)pos<=l, 2,  "out of range");
-  lua_pushnumber(L, (unsigned char)s[pos-1]);
+  lua_pushnumber(L, uchar(s[pos-1]));
   return 1;
   return 1;
 }
 }
 
 
@@ -103,8 +103,8 @@ static int str_char (lua_State *L) {
   luaL_buffinit(L, &b);
   luaL_buffinit(L, &b);
   for (i=1; i<=n; i++) {
   for (i=1; i<=n; i++) {
     int c = luaL_check_int(L, i);
     int c = luaL_check_int(L, i);
-    luaL_arg_check(L, (unsigned char)c == c, i, "invalid value");
-    luaL_putchar(&b, (unsigned char)c);
+    luaL_arg_check(L, uchar(c) == c, i, "invalid value");
+    luaL_putchar(&b, uchar(c));
   }
   }
   luaL_pushresult(&b);
   luaL_pushresult(&b);
   return 1;
   return 1;
@@ -177,26 +177,26 @@ static const char *luaI_classend (MatchState *ms, const char *p) {
 }
 }
 
 
 
 
-static int match_class (int c, int cl) {
+static int match_class (char c, char cl) {
   int res;
   int res;
-  switch (tolower(cl)) {
-    case 'a' : res = isalpha(c); break;
-    case 'c' : res = iscntrl(c); break;
-    case 'd' : res = isdigit(c); break;
-    case 'l' : res = islower(c); break;
-    case 'p' : res = ispunct(c); break;
-    case 's' : res = isspace(c); break;
-    case 'u' : res = isupper(c); break;
-    case 'w' : res = isalnum(c); break;
-    case 'x' : res = isxdigit(c); break;
+  switch (tolower(uchar(cl))) {
+    case 'a' : res = isalpha(uchar(c)); break;
+    case 'c' : res = iscntrl(uchar(c)); break;
+    case 'd' : res = isdigit(uchar(c)); break;
+    case 'l' : res = islower(uchar(c)); break;
+    case 'p' : res = ispunct(uchar(c)); break;
+    case 's' : res = isspace(uchar(c)); break;
+    case 'u' : res = isupper(uchar(c)); break;
+    case 'w' : res = isalnum(uchar(c)); break;
+    case 'x' : res = isxdigit(uchar(c)); break;
     case 'z' : res = (c == '\0'); break;
     case 'z' : res = (c == '\0'); break;
     default: return (cl == c);
     default: return (cl == c);
   }
   }
-  return (islower(cl) ? res : !res);
+  return (islower(uchar(cl)) ? res : !res);
 }
 }
 
 
 
 
-static int matchbracketclass (int c, const char *p, const char *endclass) {
+static int matchbracketclass (char c, const char *p, const char *endclass) {
   int sig = 1;
   int sig = 1;
   if (*(p+1) == '^') {
   if (*(p+1) == '^') {
     sig = 0;
     sig = 0;
@@ -205,30 +205,30 @@ static int matchbracketclass (int c, const char *p, const char *endclass) {
   while (++p < endclass) {
   while (++p < endclass) {
     if (*p == ESC) {
     if (*p == ESC) {
       p++;
       p++;
-      if (match_class(c, (unsigned char)*p))
+      if (match_class(c, *p))
         return sig;
         return sig;
     }
     }
     else if ((*(p+1) == '-') && (p+2 < endclass)) {
     else if ((*(p+1) == '-') && (p+2 < endclass)) {
       p+=2;
       p+=2;
-      if ((int)(unsigned char)*(p-2) <= c && c <= (int)(unsigned char)*p)
+      if (uchar(*(p-2)) <= uchar(c) && uchar(c) <= uchar(*p))
         return sig;
         return sig;
     }
     }
-    else if ((int)(unsigned char)*p == c) return sig;
+    else if (*p == c) return sig;
   }
   }
   return !sig;
   return !sig;
 }
 }
 
 
 
 
-static int luaI_singlematch (int c, const char *p, const char *ep) {
+static int luaI_singlematch (char c, const char *p, const char *ep) {
   switch (*p) {
   switch (*p) {
     case '.':  /* matches any char */
     case '.':  /* matches any char */
       return 1;
       return 1;
     case ESC:
     case ESC:
-      return match_class(c, (unsigned char)*(p+1));
+      return match_class(c, *(p+1));
     case '[':
     case '[':
       return matchbracketclass(c, p, ep-1);
       return matchbracketclass(c, p, ep-1);
     default:
     default:
-      return ((unsigned char)*p == c);
+      return (*p == c);
   }
   }
 }
 }
 
 
@@ -258,7 +258,7 @@ static const char *matchbalance (MatchState *ms, const char *s, const char *p) {
 static const char *max_expand (MatchState *ms, const char *s, const char *p,
 static const char *max_expand (MatchState *ms, const char *s, const char *p,
                                const char *ep) {
                                const char *ep) {
   sint32 i = 0;  /* counts maximum expand for item */
   sint32 i = 0;  /* counts maximum expand for item */
-  while ((s+i)<ms->src_end && luaI_singlematch((unsigned char)*(s+i), p, ep))
+  while ((s+i)<ms->src_end && luaI_singlematch(*(s+i), p, ep))
     i++;
     i++;
   /* keeps trying to match with the maximum repetitions */
   /* keeps trying to match with the maximum repetitions */
   while (i>=0) {
   while (i>=0) {
@@ -276,7 +276,7 @@ static const char *min_expand (MatchState *ms, const char *s, const char *p,
     const char *res = match(ms, s, ep+1);
     const char *res = match(ms, s, ep+1);
     if (res != NULL)
     if (res != NULL)
       return res;
       return res;
-    else if (s<ms->src_end && luaI_singlematch((unsigned char)*s, p, ep))
+    else if (s<ms->src_end && luaI_singlematch(*s, p, ep))
       s++;  /* try with one more repetition */
       s++;  /* try with one more repetition */
     else return NULL;
     else return NULL;
   }
   }
@@ -328,7 +328,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
     case ')':  /* end capture */
     case ')':  /* end capture */
       return end_capture(ms, s, p+1);
       return end_capture(ms, s, p+1);
     case ESC:  /* may be %[0-9] or %b */
     case ESC:  /* may be %[0-9] or %b */
-      if (isdigit((unsigned char)(*(p+1)))) {  /* capture? */
+      if (isdigit(uchar(*(p+1)))) {  /* capture? */
         s = match_capture(ms, s, *(p+1));
         s = match_capture(ms, s, *(p+1));
         if (s == NULL) return NULL;
         if (s == NULL) return NULL;
         p+=2; goto init;  /* else return match(ms, s, p+2) */
         p+=2; goto init;  /* else return match(ms, s, p+2) */
@@ -347,7 +347,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
       else goto dflt;
       else goto dflt;
     default: dflt: {  /* it is a pattern item */
     default: dflt: {  /* it is a pattern item */
       const char *ep = luaI_classend(ms, p);  /* points to what is next */
       const char *ep = luaI_classend(ms, p);  /* points to what is next */
-      int m = s<ms->src_end && luaI_singlematch((unsigned char)*s, p, ep);
+      int m = s<ms->src_end && luaI_singlematch(*s, p, ep);
       switch (*ep) {
       switch (*ep) {
         case '?': {  /* optional */
         case '?': {  /* optional */
           const char *res;
           const char *res;
@@ -460,7 +460,7 @@ static void add_s (MatchState *ms, luaL_Buffer *b) {
         luaL_putchar(b, news[i]);
         luaL_putchar(b, news[i]);
       else {
       else {
         i++;  /* skip ESC */
         i++;  /* skip ESC */
-        if (!isdigit((unsigned char)news[i]))
+        if (!isdigit(uchar(news[i])))
           luaL_putchar(b, news[i]);
           luaL_putchar(b, news[i]);
         else {
         else {
           int level = check_capture(ms, news[i]);
           int level = check_capture(ms, news[i]);
@@ -552,15 +552,15 @@ static const char *scanformat (lua_State *L, const char *strfrmt, char *form,
                                int *hasprecision) {
                                int *hasprecision) {
   const char *p = strfrmt;
   const char *p = strfrmt;
   while (strchr("-+ #0", *p)) p++;  /* skip flags */
   while (strchr("-+ #0", *p)) p++;  /* skip flags */
-  if (isdigit((unsigned char)*p)) p++;  /* skip width */
-  if (isdigit((unsigned char)*p)) p++;  /* (2 digits at most) */
+  if (isdigit(uchar(*p))) p++;  /* skip width */
+  if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
   if (*p == '.') {
   if (*p == '.') {
     p++;
     p++;
     *hasprecision = 1;
     *hasprecision = 1;
-    if (isdigit((unsigned char)*p)) p++;  /* skip precision */
-    if (isdigit((unsigned char)*p)) p++;  /* (2 digits at most) */
+    if (isdigit(uchar(*p))) p++;  /* skip precision */
+    if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
   }
   }
-  if (isdigit((unsigned char)*p))
+  if (isdigit(uchar(*p)))
     lua_error(L, "invalid format (width or precision too long)");
     lua_error(L, "invalid format (width or precision too long)");
   if (p-strfrmt+2 > MAX_FORMAT)  /* +2 to include `%' and the specifier */
   if (p-strfrmt+2 > MAX_FORMAT)  /* +2 to include `%' and the specifier */
     lua_error(L, "invalid format (too long)");
     lua_error(L, "invalid format (too long)");
@@ -585,7 +585,7 @@ static int str_format (lua_State *L) {
       char form[MAX_FORMAT];  /* to store the format (`%...') */
       char form[MAX_FORMAT];  /* to store the format (`%...') */
       char buff[MAX_ITEM];  /* to store the formatted item */
       char buff[MAX_ITEM];  /* to store the formatted item */
       int hasprecision = 0;
       int hasprecision = 0;
-      if (isdigit((unsigned char)*strfrmt) && *(strfrmt+1) == '$')
+      if (isdigit(uchar(*strfrmt)) && *(strfrmt+1) == '$')
         lua_error(L, "obsolete `format' option (d$)");
         lua_error(L, "obsolete `format' option (d$)");
       arg++;
       arg++;
       strfrmt = scanformat(L, strfrmt, form, &hasprecision);
       strfrmt = scanformat(L, strfrmt, form, &hasprecision);

+ 10 - 9
lua.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lua.h,v 1.86 2001/02/09 19:53:16 roberto Exp roberto $
+** $Id: lua.h,v 1.87 2001/02/20 18:15:33 roberto Exp roberto $
 ** Lua - An Extensible Extension Language
 ** Lua - An Extensible Extension Language
 ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
 ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
 ** e-mail: [email protected]
 ** e-mail: [email protected]
@@ -39,10 +39,6 @@
 #define LUA_MULTRET	(-1)
 #define LUA_MULTRET	(-1)
 
 
 
 
-/* minimum stack available for a C function */
-#define LUA_MINSTACK	20
-
-
 /* error codes for lua_do* */
 /* error codes for lua_do* */
 #define LUA_ERRRUN	1
 #define LUA_ERRRUN	1
 #define LUA_ERRFILE	2
 #define LUA_ERRFILE	2
@@ -50,10 +46,6 @@
 #define LUA_ERRMEM	4
 #define LUA_ERRMEM	4
 #define LUA_ERRERR	5
 #define LUA_ERRERR	5
 
 
-
-/* Lua numerical type */
-typedef double lua_Number;
-
 typedef struct lua_State lua_State;
 typedef struct lua_State lua_State;
 
 
 typedef int (*lua_CFunction) (lua_State *L);
 typedef int (*lua_CFunction) (lua_State *L);
@@ -71,6 +63,7 @@ typedef int (*lua_CFunction) (lua_State *L);
 #define LUA_TFUNCTION	5
 #define LUA_TFUNCTION	5
 
 
 
 
+
 /*
 /*
 ** generic extra include file
 ** generic extra include file
 */
 */
@@ -79,6 +72,14 @@ typedef int (*lua_CFunction) (lua_State *L);
 #endif
 #endif
 
 
 
 
+/* minimum stack available for a C function */
+#define LUA_MINSTACK	20
+
+
+/* Lua numerical type */
+typedef double lua_Number;
+
+
 
 
 /* mark for all API functions */
 /* mark for all API functions */
 #ifndef LUA_API
 #ifndef LUA_API

+ 12 - 1
lualib.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lualib.h,v 1.14 2000/10/27 16:15:53 roberto Exp roberto $
+** $Id: lualib.h,v 1.15 2000/11/23 13:49:35 roberto Exp roberto $
 ** Lua standard libraries
 ** Lua standard libraries
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -25,4 +25,15 @@ LUALIB_API void lua_mathlibopen (lua_State *L);
 LUALIB_API void lua_dblibopen (lua_State *L);
 LUALIB_API void lua_dblibopen (lua_State *L);
 
 
 
 
+
+/*
+** `private' part
+*/
+
+/* macro to `unsign' a character */
+#define uchar(c)	((unsigned char)(c))
+
+/* integer type to hold the result of fgetc */
+typedef int l_charint;
+
 #endif
 #endif