浏览代码

change in 'LUAI_DDEC' to allow variables to be static in 'onelua'
+ change in 'LUAMOD_API' as opening functions do not need to be global

Roberto Ierusalimschy 7 年之前
父节点
当前提交
b43300c14f
共有 4 个文件被更改,包括 17 次插入13 次删除
  1. 2 2
      lctype.h
  2. 3 3
      lopcodes.h
  3. 2 2
      ltm.h
  4. 10 6
      luaconf.h

+ 2 - 2
lctype.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lctype.h,v 1.11 2011/06/27 18:22:46 roberto Exp roberto $
+** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp roberto $
 ** 'ctype' functions for Lua
 ** See Copyright Notice in lua.h
 */
@@ -68,7 +68,7 @@
 
 
 /* two more entries for 0 and -1 (EOZ) */
-LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2];
+LUAI_DDEC(const lu_byte luai_ctype_[UCHAR_MAX + 2];)
 
 
 #else			/* }{ */

+ 3 - 3
lopcodes.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lopcodes.h,v 1.191 2018/04/04 14:23:41 roberto Exp roberto $
+** $Id: lopcodes.h,v 1.192 2018/06/08 19:07:27 roberto Exp roberto $
 ** Opcodes for Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -339,7 +339,7 @@ OP_EXTRAARG/*	Ax	extra (larger) argument for previous opcode	*/
 ** bit 6: instruction sets 'L->top' for next instruction (when C == 0)
 */
 
-LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
+LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];)
 
 #define getOpMode(m)	(cast(enum OpMode, luaP_opmodes[m] & 7))
 #define testAMode(m)	(luaP_opmodes[m] & (1 << 3))
@@ -358,7 +358,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
 #define opmode(ot,it,t,a,m) (((ot)<<6) | ((it)<<5) | ((t)<<4) | ((a)<<3) | (m))
 
 
-LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1];  /* opcode names */
+LUAI_DDEC(const char *const luaP_opnames[NUM_OPCODES+1];)  /* opcode names */
 
 
 /* number of list items to accumulate before a SETLIST instruction */

+ 2 - 2
ltm.h

@@ -1,5 +1,5 @@
 /*
-** $Id: ltm.h,v 2.37 2018/06/01 16:51:34 roberto Exp roberto $
+** $Id: ltm.h,v 2.38 2018/06/08 19:06:59 roberto Exp roberto $
 ** Tag methods
 ** See Copyright Notice in lua.h
 */
@@ -58,7 +58,7 @@ typedef enum {
 
 #define ttypename(x)	luaT_typenames_[(x) + 1]
 
-LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];
+LUAI_DDEC(const char *const luaT_typenames_[LUA_TOTALTAGS];)
 
 
 LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o);

+ 10 - 6
luaconf.h

@@ -1,5 +1,5 @@
 /*
-** $Id: luaconf.h,v 1.268 2018/04/02 13:58:33 roberto Exp roberto $
+** $Id: luaconf.h,v 1.269 2018/06/15 15:49:28 roberto Exp roberto $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */
@@ -254,16 +254,20 @@
 #endif				/* } */
 
 
-/* more often than not the libs go together with the core */
+/*
+** More often than not the libs go together with the core;
+** Functions from the auxiliary library must be exported,
+** but opening functions do not.
+*/
 #define LUALIB_API	LUA_API
-#define LUAMOD_API	LUALIB_API
+#define LUAMOD_API	LUAI_FUNC
 
 
 /*
 @@ LUAI_FUNC is a mark for all extern functions that are not to be
 ** exported to outside modules.
-@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
-** that are not to be exported to outside modules (LUAI_DDEF for
+@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables,
+** none of which to be exported to outside modules (LUAI_DDEF for
 ** definitions and LUAI_DDEC for declarations).
 ** CHANGE them if you need to mark them in some special way. Elf/gcc
 ** (versions 3.2 and later) mark them as "hidden" to optimize access
@@ -280,7 +284,7 @@
 #define LUAI_FUNC	extern
 #endif				/* } */
 
-#define LUAI_DDEC	LUAI_FUNC
+#define LUAI_DDEC(dec)	LUAI_FUNC dec
 #define LUAI_DDEF	/* empty */
 
 /* }================================================================== */