Просмотр исходного кода

avoid C identifiers beginning with '_'

Roberto Ierusalimschy 23 лет назад
Родитель
Сommit
71c716e5a8
7 измененных файлов с 31 добавлено и 31 удалено
  1. 5 5
      ldebug.c
  2. 3 3
      ldo.c
  3. 10 10
      lobject.h
  4. 5 5
      lstate.c
  5. 3 3
      lstate.h
  6. 3 3
      ltable.h
  7. 2 2
      luadebug.h

+ 5 - 5
ldebug.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldebug.c,v 1.100 2002/02/05 22:39:12 roberto Exp $
+** $Id: ldebug.c,v 1.101 2002/03/08 19:10:32 roberto Exp roberto $
 ** Debug Interface
 ** See Copyright Notice in lua.h
 */
@@ -59,7 +59,7 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
   lua_lock(L);
   if (L->ci - L->base_ci <= level) status = 0;  /* there is no such level */
   else {
-    ar->_ci = (L->ci - L->base_ci) - level;
+    ar->i_ci = (L->ci - L->base_ci) - level;
     status = 1;
   }
   lua_unlock(L);
@@ -129,7 +129,7 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
   Proto *fp;
   lua_lock(L);
   name = NULL;
-  ci = L->base_ci + ar->_ci;
+  ci = L->base_ci + ar->i_ci;
   fp = getluaproto(ci);
   if (fp) {  /* is a Lua function? */
     name = luaF_getlocalname(fp, n, currentpc(L, ci));
@@ -147,7 +147,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
   Proto *fp;
   lua_lock(L);
   name = NULL;
-  ci = L->base_ci + ar->_ci;
+  ci = L->base_ci + ar->i_ci;
   fp = getluaproto(ci);
   L->top--;  /* pop new value */
   if (fp) {  /* is a Lua function? */
@@ -216,7 +216,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
   int status = 1;
   lua_lock(L);
   if (*what != '>') {  /* function is active? */
-    ci = L->base_ci + ar->_ci;
+    ci = L->base_ci + ar->i_ci;
     f = ci->base - 1;
   }
   else {

+ 3 - 3
ldo.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldo.c,v 1.161 2002/03/07 18:14:29 roberto Exp roberto $
+** $Id: ldo.c,v 1.162 2002/03/08 19:11:03 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 */
@@ -124,7 +124,7 @@ void luaD_lineHook (lua_State *L, int line, lua_Hook linehook) {
   if (L->allowhooks) {
     lua_Debug ar;
     ar.event = "line";
-    ar._ci = L->ci - L->base_ci;
+    ar.i_ci = L->ci - L->base_ci;
     ar.currentline = line;
     dohook(L, &ar, linehook);
   }
@@ -135,7 +135,7 @@ static void luaD_callHook (lua_State *L, lua_Hook callhook, const char *event) {
   if (L->allowhooks) {
     lua_Debug ar;
     ar.event = event;
-    ar._ci = L->ci - L->base_ci;
+    ar.i_ci = L->ci - L->base_ci;
     L->ci->pc = NULL;  /* function is not active */
     dohook(L, &ar, callhook);
   }

+ 10 - 10
lobject.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.h,v 1.124 2002/02/08 22:42:41 roberto Exp roberto $
+** $Id: lobject.h,v 1.125 2002/03/05 12:42:47 roberto Exp roberto $
 ** Type definitions for Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -63,29 +63,29 @@ typedef struct lua_TObject {
 
 /* Macros to set values */
 #define setnvalue(obj,x) \
-  { TObject *_o=(obj); _o->tt=LUA_TNUMBER; _o->value.n=(x); }
+  { TObject *i_o=(obj); i_o->tt=LUA_TNUMBER; i_o->value.n=(x); }
 
 #define chgnvalue(obj,x)	((obj)->value.n=(x))
 
 #define setbvalue(obj,x) \
-  { TObject *_o=(obj); _o->tt=LUA_TBOOLEAN; _o->value.b=(x); }
+  { TObject *i_o=(obj); i_o->tt=LUA_TBOOLEAN; i_o->value.b=(x); }
 
 #define setsvalue(obj,x) \
-  { TObject *_o=(obj); _o->tt=LUA_TSTRING; _o->value.ts=(x); }
+  { TObject *i_o=(obj); i_o->tt=LUA_TSTRING; i_o->value.ts=(x); }
 
 #define setuvalue(obj,x) \
-  { TObject *_o=(obj); _o->tt=LUA_TUSERDATA; _o->value.u=(x); }
+  { TObject *i_o=(obj); i_o->tt=LUA_TUSERDATA; i_o->value.u=(x); }
 
 #define setclvalue(obj,x) \
-  { TObject *_o=(obj); _o->tt=LUA_TFUNCTION; _o->value.cl=(x); }
+  { TObject *i_o=(obj); i_o->tt=LUA_TFUNCTION; i_o->value.cl=(x); }
 
 #define sethvalue(obj,x) \
-  { TObject *_o=(obj); _o->tt=LUA_TTABLE; _o->value.h=(x); }
+  { TObject *i_o=(obj); i_o->tt=LUA_TTABLE; i_o->value.h=(x); }
 
 #define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
 
 #define setupvalue(obj,x,t) \
-  { TObject *_o=(obj); _o->tt=(t); _o->value.v=(x); }
+  { TObject *i_o=(obj); i_o->tt=(t); i_o->value.v=(x); }
 
 #define setobj(obj1,obj2) \
   { TObject *o1=(obj1); const TObject *o2=(obj2); \
@@ -213,8 +213,8 @@ typedef union Closure {
 */
 
 typedef struct Node {
-  TObject _key;
-  TObject _val;
+  TObject i_key;
+  TObject i_val;
   struct Node *next;  /* for chaining */
 } Node;
 

+ 5 - 5
lstate.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.c,v 1.85 2002/03/05 16:22:54 roberto Exp roberto $
+** $Id: lstate.c,v 1.86 2002/03/07 18:14:29 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -46,7 +46,7 @@ static void stack_init (lua_State *L, lua_State *OL) {
 static void f_luaopen (lua_State *L, void *ud) {
   UNUSED(ud);
   /* create a new global state */
-  L->_G = luaM_new(L, global_State);
+  L->l_G = luaM_new(L, global_State);
   G(L)->strt.size = 0;
   G(L)->strt.nuse = 0;
   G(L)->strt.hash = NULL;
@@ -91,7 +91,7 @@ LUA_API lua_State *lua_newthread (lua_State *OL) {
   lua_lock(OL);
   L = luaM_new(OL, lua_State);
   preinit_state(L);
-  L->_G = OL->_G;
+  L->l_G = OL->l_G;
   OL->next->previous = L;  /* insert L into linked list */
   L->next = OL->next;
   OL->next = L;
@@ -111,7 +111,7 @@ LUA_API lua_State *lua_open (void) {
   L = luaM_new(NULL, lua_State);
   if (L) {  /* allocation OK? */
     preinit_state(L);
-    L->_G = NULL;
+    L->l_G = NULL;
     L->next = L->previous = L;
     if (luaD_runprotected(L, f_luaopen, NULL) != 0) {
       /* memory allocation error: free partial state */
@@ -146,7 +146,7 @@ static void close_state (lua_State *L) {
     lua_assert(G(L)->roottable == NULL);
     luaS_freeall(L);
     luaM_freearray(L, G(L)->Mbuffer, G(L)->Mbuffsize, char);
-    luaM_freelem(NULL, L->_G);
+    luaM_freelem(NULL, L->l_G);
   }
   luaE_closethread(NULL, L);
 }

+ 3 - 3
lstate.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.h,v 1.77 2002/02/14 21:47:29 roberto Exp roberto $
+** $Id: lstate.h,v 1.78 2002/03/07 18:11:51 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -132,7 +132,7 @@ struct lua_State {
   StkId stack;  /* stack base */
   CallInfo *end_ci;  /* points after end of ci array*/
   CallInfo *base_ci;  /* array of CallInfo's */
-  global_State *_G;
+  global_State *l_G;
   struct lua_longjmp *errorJmp;  /* current error recover point */
   UpVal *openupval;  /* list of open upvalues in this stack */
   lua_State *next;  /* circular double linked list of states */
@@ -145,7 +145,7 @@ struct lua_State {
 };
 
 
-#define G(L)	(L->_G)
+#define G(L)	(L->l_G)
 
 
 void luaE_closethread (lua_State *OL, lua_State *L);

+ 3 - 3
ltable.h

@@ -1,5 +1,5 @@
 /*
-** $Id: ltable.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $
+** $Id: ltable.h,v 1.40 2002/02/14 21:41:08 roberto Exp roberto $
 ** Lua tables (hash)
 ** See Copyright Notice in lua.h
 */
@@ -11,8 +11,8 @@
 
 
 #define node(t,i)	(&(t)->node[i])
-#define key(n)		(&(n)->_key)
-#define val(n)		(&(n)->_val)
+#define key(n)		(&(n)->i_key)
+#define val(n)		(&(n)->i_val)
 
 #define settableval(p,v)	setobj(cast(TObject *, p), v)
 

+ 2 - 2
luadebug.h

@@ -1,5 +1,5 @@
 /*
-** $Id: luadebug.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $
+** $Id: luadebug.h,v 1.24 2002/02/08 22:42:41 roberto Exp roberto $
 ** Debugging API
 ** See Copyright Notice in lua.h
 */
@@ -38,7 +38,7 @@ struct lua_Debug {
   int linedefined;       /* (S) */
   char short_src[LUA_IDSIZE]; /* (S) */
   /* private part */
-  int _ci;  /* active function */
+  int i_ci;  /* active function */
 };