From b43300c14f562bcdc1050f2c05e52fac3f6c99b7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 18 Jun 2018 09:51:05 -0300 Subject: [PATCH] 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 --- lctype.h | 4 ++-- lopcodes.h | 6 +++--- ltm.h | 4 ++-- luaconf.h | 16 ++++++++++------ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lctype.h b/lctype.h index 5dc17013..de1efd51 100644 --- a/lctype.h +++ b/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 /* }{ */ diff --git a/lopcodes.h b/lopcodes.h index 9c447a41..821bb196 100644 --- a/lopcodes.h +++ b/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 */ diff --git a/ltm.h b/ltm.h index 3069a3ba..12ae09de 100644 --- a/ltm.h +++ b/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); diff --git a/luaconf.h b/luaconf.h index 64565066..f1ca51f5 100644 --- a/luaconf.h +++ b/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 */ /* }================================================================== */