Browse Source

avoid use of l_char outside INTERNALs (use lua_char instead)

Roberto Ierusalimschy 24 years ago
parent
commit
2a50188269
3 changed files with 61 additions and 54 deletions
  1. 20 15
      lauxlib.h
  2. 31 29
      lua.h
  3. 10 10
      luadebug.h

+ 20 - 15
lauxlib.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lauxlib.h,v 1.33 2001/02/02 19:02:40 roberto Exp roberto $
+** $Id: lauxlib.h,v 1.34 2001/02/23 17:17:25 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -21,25 +21,30 @@
 
 
 
 
 typedef struct luaL_reg {
 typedef struct luaL_reg {
-  const l_char *name;
+  const lua_char *name;
   lua_CFunction func;
   lua_CFunction func;
 } luaL_reg;
 } luaL_reg;
 
 
 
 
 LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int n);
 LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int n);
-LUALIB_API void luaL_argerror (lua_State *L, int numarg, const l_char *extramsg);
-LUALIB_API const l_char *luaL_check_lstr (lua_State *L, int numArg, size_t *len);
-LUALIB_API const l_char *luaL_opt_lstr (lua_State *L, int numArg, const l_char *def, size_t *len);
+LUALIB_API void luaL_argerror (lua_State *L, int numarg,
+                               const lua_char *extramsg);
+LUALIB_API const lua_char *luaL_check_lstr (lua_State *L, int numArg,
+                                            size_t *len);
+LUALIB_API const lua_char *luaL_opt_lstr (lua_State *L, int numArg,
+                                          const lua_char *def, size_t *len);
 LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg);
 LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg);
 LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def);
 LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def);
 
 
-LUALIB_API void luaL_checkstack (lua_State *L, int space, const l_char *msg);
+LUALIB_API void luaL_checkstack (lua_State *L, int space, const lua_char *msg);
 LUALIB_API void luaL_checktype (lua_State *L, int narg, int t);
 LUALIB_API void luaL_checktype (lua_State *L, int narg, int t);
 LUALIB_API void luaL_checkany (lua_State *L, int narg);
 LUALIB_API void luaL_checkany (lua_State *L, int narg);
-LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, const l_char *name);
+LUALIB_API void *luaL_check_userdata (lua_State *L, int narg,
+                                      const lua_char *name);
 
 
-LUALIB_API void luaL_verror (lua_State *L, const l_char *fmt, ...);
-LUALIB_API int luaL_findstring (const l_char *name, const l_char *const list[]);
+LUALIB_API void luaL_verror (lua_State *L, const lua_char *fmt, ...);
+LUALIB_API int luaL_findstring (const lua_char *name, 
+                                const lua_char *const list[]);
 
 
 
 
 
 
@@ -73,22 +78,22 @@ LUALIB_API int luaL_findstring (const l_char *name, const l_char *const list[]);
 
 
 
 
 typedef struct luaL_Buffer {
 typedef struct luaL_Buffer {
-  l_char *p;			/* current position in buffer */
+  lua_char *p;			/* current position in buffer */
   int level;
   int level;
   lua_State *L;
   lua_State *L;
-  l_char buffer[LUAL_BUFFERSIZE];
+  lua_char buffer[LUAL_BUFFERSIZE];
 } luaL_Buffer;
 } luaL_Buffer;
 
 
 #define luaL_putchar(B,c) \
 #define luaL_putchar(B,c) \
   ((void)((B)->p < &(B)->buffer[LUAL_BUFFERSIZE] || luaL_prepbuffer(B)), \
   ((void)((B)->p < &(B)->buffer[LUAL_BUFFERSIZE] || luaL_prepbuffer(B)), \
-   (*(B)->p++ = (l_char)(c)))
+   (*(B)->p++ = (lua_char)(c)))
 
 
 #define luaL_addsize(B,n)	((B)->p += (n))
 #define luaL_addsize(B,n)	((B)->p += (n))
 
 
 LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B);
 LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B);
-LUALIB_API l_char *luaL_prepbuffer (luaL_Buffer *B);
-LUALIB_API void luaL_addlstring (luaL_Buffer *B, const l_char *s, size_t l);
-LUALIB_API void luaL_addstring (luaL_Buffer *B, const l_char *s);
+LUALIB_API lua_char *luaL_prepbuffer (luaL_Buffer *B);
+LUALIB_API void luaL_addlstring (luaL_Buffer *B, const lua_char *s, size_t l);
+LUALIB_API void luaL_addstring (luaL_Buffer *B, const lua_char *s);
 LUALIB_API void luaL_addvalue (luaL_Buffer *B);
 LUALIB_API void luaL_addvalue (luaL_Buffer *B);
 LUALIB_API void luaL_pushresult (luaL_Buffer *B);
 LUALIB_API void luaL_pushresult (luaL_Buffer *B);
 
 

+ 31 - 29
lua.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lua.h,v 1.91 2001/03/09 18:05:05 roberto Exp roberto $
+** $Id: lua.h,v 1.92 2001/03/26 14:31:49 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]
@@ -86,7 +86,7 @@ typedef LUA_NUMBER lua_Number;
 #ifndef L_CHAR
 #ifndef L_CHAR
 #define L_CHAR	char
 #define L_CHAR	char
 #endif
 #endif
-typedef L_CHAR l_char;
+typedef L_CHAR lua_char;
 
 
 
 
 /* mark for all API functions */
 /* mark for all API functions */
@@ -117,23 +117,23 @@ LUA_API int   lua_stackspace (lua_State *L);
 ** access functions (stack -> C)
 ** access functions (stack -> C)
 */
 */
 
 
-LUA_API int            lua_type (lua_State *L, int index);
-LUA_API const l_char  *lua_typename (lua_State *L, int t);
-LUA_API const l_char  *lua_xtype (lua_State *L, int index);
-LUA_API int            lua_isnumber (lua_State *L, int index);
-LUA_API int            lua_isstring (lua_State *L, int index);
-LUA_API int            lua_iscfunction (lua_State *L, int index);
-LUA_API int            lua_tag (lua_State *L, int index);
+LUA_API int             lua_type (lua_State *L, int index);
+LUA_API const lua_char *lua_typename (lua_State *L, int t);
+LUA_API const lua_char *lua_xtype (lua_State *L, int index);
+LUA_API int             lua_isnumber (lua_State *L, int index);
+LUA_API int             lua_isstring (lua_State *L, int index);
+LUA_API int             lua_iscfunction (lua_State *L, int index);
+LUA_API int             lua_tag (lua_State *L, int index);
 
 
 LUA_API int            lua_equal (lua_State *L, int index1, int index2);
 LUA_API int            lua_equal (lua_State *L, int index1, int index2);
 LUA_API int            lua_lessthan (lua_State *L, int index1, int index2);
 LUA_API int            lua_lessthan (lua_State *L, int index1, int index2);
 
 
-LUA_API lua_Number     lua_tonumber (lua_State *L, int index);
-LUA_API const l_char  *lua_tostring (lua_State *L, int index);
-LUA_API size_t         lua_strlen (lua_State *L, int index);
-LUA_API lua_CFunction  lua_tocfunction (lua_State *L, int index);
-LUA_API void	      *lua_touserdata (lua_State *L, int index);
-LUA_API const void    *lua_topointer (lua_State *L, int index);
+LUA_API lua_Number      lua_tonumber (lua_State *L, int index);
+LUA_API const lua_char *lua_tostring (lua_State *L, int index);
+LUA_API size_t          lua_strlen (lua_State *L, int index);
+LUA_API lua_CFunction   lua_tocfunction (lua_State *L, int index);
+LUA_API void	       *lua_touserdata (lua_State *L, int index);
+LUA_API const void     *lua_topointer (lua_State *L, int index);
 
 
 
 
 /*
 /*
@@ -141,8 +141,8 @@ LUA_API const void    *lua_topointer (lua_State *L, int index);
 */
 */
 LUA_API void  lua_pushnil (lua_State *L);
 LUA_API void  lua_pushnil (lua_State *L);
 LUA_API void  lua_pushnumber (lua_State *L, lua_Number n);
 LUA_API void  lua_pushnumber (lua_State *L, lua_Number n);
-LUA_API void  lua_pushlstring (lua_State *L, const l_char *s, size_t len);
-LUA_API void  lua_pushstring (lua_State *L, const l_char *s);
+LUA_API void  lua_pushlstring (lua_State *L, const lua_char *s, size_t len);
+LUA_API void  lua_pushstring (lua_State *L, const lua_char *s);
 LUA_API void  lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
 LUA_API void  lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
 LUA_API int   lua_pushuserdata (lua_State *L, void *u);
 LUA_API int   lua_pushuserdata (lua_State *L, void *u);
 
 
@@ -150,12 +150,12 @@ LUA_API int   lua_pushuserdata (lua_State *L, void *u);
 /*
 /*
 ** get functions (Lua -> stack)
 ** get functions (Lua -> stack)
 */
 */
-LUA_API void  lua_getglobal (lua_State *L, const l_char *name);
+LUA_API void  lua_getglobal (lua_State *L, const lua_char *name);
 LUA_API void  lua_gettable (lua_State *L, int index);
 LUA_API void  lua_gettable (lua_State *L, int index);
 LUA_API void  lua_rawget (lua_State *L, int index);
 LUA_API void  lua_rawget (lua_State *L, int index);
 LUA_API void  lua_rawgeti (lua_State *L, int index, int n);
 LUA_API void  lua_rawgeti (lua_State *L, int index, int n);
 LUA_API void  lua_getglobals (lua_State *L);
 LUA_API void  lua_getglobals (lua_State *L);
-LUA_API void  lua_gettagmethod (lua_State *L, int tag, const l_char *event);
+LUA_API void  lua_gettagmethod (lua_State *L, int tag, const lua_char *event);
 LUA_API int   lua_getref (lua_State *L, int ref);
 LUA_API int   lua_getref (lua_State *L, int ref);
 LUA_API void  lua_newtable (lua_State *L);
 LUA_API void  lua_newtable (lua_State *L);
 
 
@@ -163,12 +163,12 @@ LUA_API void  lua_newtable (lua_State *L);
 /*
 /*
 ** set functions (stack -> Lua)
 ** set functions (stack -> Lua)
 */
 */
-LUA_API void  lua_setglobal (lua_State *L, const l_char *name);
+LUA_API void  lua_setglobal (lua_State *L, const lua_char *name);
 LUA_API void  lua_settable (lua_State *L, int index);
 LUA_API void  lua_settable (lua_State *L, int index);
 LUA_API void  lua_rawset (lua_State *L, int index);
 LUA_API void  lua_rawset (lua_State *L, int index);
 LUA_API void  lua_rawseti (lua_State *L, int index, int n);
 LUA_API void  lua_rawseti (lua_State *L, int index, int n);
 LUA_API void  lua_setglobals (lua_State *L);
 LUA_API void  lua_setglobals (lua_State *L);
-LUA_API void  lua_settagmethod (lua_State *L, int tag, const l_char *event);
+LUA_API void  lua_settagmethod (lua_State *L, int tag, const lua_char *event);
 LUA_API int   lua_ref (lua_State *L, int lock);
 LUA_API int   lua_ref (lua_State *L, int lock);
 
 
 
 
@@ -177,10 +177,10 @@ LUA_API int   lua_ref (lua_State *L, int lock);
 */
 */
 LUA_API int   lua_call (lua_State *L, int nargs, int nresults);
 LUA_API int   lua_call (lua_State *L, int nargs, int nresults);
 LUA_API void  lua_rawcall (lua_State *L, int nargs, int nresults);
 LUA_API void  lua_rawcall (lua_State *L, int nargs, int nresults);
-LUA_API int   lua_dofile (lua_State *L, const l_char *filename);
-LUA_API int   lua_dostring (lua_State *L, const l_char *str);
-LUA_API int   lua_dobuffer (lua_State *L, const l_char *buff, size_t size,
-                            const l_char *name);
+LUA_API int   lua_dofile (lua_State *L, const lua_char *filename);
+LUA_API int   lua_dostring (lua_State *L, const lua_char *str);
+LUA_API int   lua_dobuffer (lua_State *L, const lua_char *buff, size_t size,
+                            const lua_char *name);
 
 
 /*
 /*
 ** Garbage-collection functions
 ** Garbage-collection functions
@@ -192,12 +192,12 @@ LUA_API void  lua_setgcthreshold (lua_State *L, int newthreshold);
 /*
 /*
 ** miscellaneous functions
 ** miscellaneous functions
 */
 */
-LUA_API int   lua_newtype (lua_State *L, const l_char *name, int basictype);
-LUA_API int   lua_type2tag (lua_State *L, const l_char *name);
+LUA_API int   lua_newtype (lua_State *L, const lua_char *name, int basictype);
+LUA_API int   lua_type2tag (lua_State *L, const lua_char *name);
 LUA_API int   lua_copytagmethods (lua_State *L, int tagto, int tagfrom);
 LUA_API int   lua_copytagmethods (lua_State *L, int tagto, int tagfrom);
 LUA_API void  lua_settag (lua_State *L, int tag);
 LUA_API void  lua_settag (lua_State *L, int tag);
 
 
-LUA_API void  lua_error (lua_State *L, const l_char *s);
+LUA_API void  lua_error (lua_State *L, const lua_char *s);
 
 
 LUA_API void  lua_unref (lua_State *L, int ref);
 LUA_API void  lua_unref (lua_State *L, int ref);
 
 
@@ -233,7 +233,7 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size);
 #define lua_getregistry(L)	lua_getref(L, LUA_REFREGISTRY)
 #define lua_getregistry(L)	lua_getref(L, LUA_REFREGISTRY)
 
 
 #define lua_pushliteral(L, s)	lua_pushlstring(L, s, \
 #define lua_pushliteral(L, s)	lua_pushlstring(L, s, \
-                                                (sizeof(s)/sizeof(l_char))-1)
+                                                (sizeof(s)/sizeof(lua_char))-1)
 
 
 
 
 
 
@@ -249,6 +249,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size);
 */
 */
 #ifdef LUA_PRIVATE
 #ifdef LUA_PRIVATE
 
 
+#define l_char	lua_char
+
 /* macro to control type of literal strings */
 /* macro to control type of literal strings */
 #ifndef l_s
 #ifndef l_s
 #define l_s(x)  x
 #define l_s(x)  x

+ 10 - 10
luadebug.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: luadebug.h,v 1.18 2001/02/23 17:17:25 roberto Exp roberto $
+** $Id: luadebug.h,v 1.19 2001/03/07 18:09:25 roberto Exp roberto $
 ** Debugging API
 ** Debugging API
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -18,9 +18,9 @@ typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
 
 
 
 
 LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
 LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
-LUA_API int lua_getinfo (lua_State *L, const l_char *what, lua_Debug *ar);
-LUA_API const l_char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
-LUA_API const l_char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+LUA_API int lua_getinfo (lua_State *L, const lua_char *what, lua_Debug *ar);
+LUA_API const lua_char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const lua_char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
 
 
 LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);
 LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);
 LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
 LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
@@ -29,15 +29,15 @@ LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
 #define LUA_IDSIZE	60
 #define LUA_IDSIZE	60
 
 
 struct lua_Debug {
 struct lua_Debug {
-  const l_char *event;     /* `call', `return' */
+  const lua_char *event;     /* `call', `return' */
   int currentline;       /* (l) */
   int currentline;       /* (l) */
-  const l_char *name;      /* (n) */
-  const l_char *namewhat;  /* (n) `global', `tag method', `local', `field' */
+  const lua_char *name;      /* (n) */
+  const lua_char *namewhat;  /* (n) `global', `tag method', `local', `field' */
   int nups;              /* (u) number of upvalues */
   int nups;              /* (u) number of upvalues */
   int linedefined;       /* (S) */
   int linedefined;       /* (S) */
-  const l_char *what;      /* (S) `Lua' function, `C' function, Lua `main' */
-  const l_char *source;    /* (S) */
-  l_char short_src[LUA_IDSIZE]; /* (S) */
+  const lua_char *what;      /* (S) `Lua' function, `C' function, Lua `main' */
+  const lua_char *source;    /* (S) */
+  lua_char short_src[LUA_IDSIZE]; /* (S) */
   /* private part */
   /* private part */
   struct CallInfo *_ci;  /* active function */
   struct CallInfo *_ci;  /* active function */
 };
 };