Changeset 165
- Timestamp:
- 07/16/13 23:40:03 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/lib/lua.hh
r164 r165 39 39 40 40 #define NV_LUA_51 0 41 #define NV_LUA_51_JIT 1 42 #define NV_LUA_52 2 43 44 #ifndef NV_LUA_VERSION 41 #define NV_LUA_52 1 42 43 #if !defined(NV_LUA_VERSION) 45 44 # define NV_LUA_VERSION NV_LUA_52 45 #endif 46 #if defined(NV_LUA_JIT) 47 # define NV_LUA_VERSION NV_LUA_51 46 48 #endif 47 49 … … 62 64 # define NV_LUA_PATH "lua5.1.so" 63 65 # endif 64 #elif NV_LUA_VERSION == NV_LUA_51_JIT 66 #else 67 # error "Unrecognized NV_LUA_VERSION!" 68 #endif 69 70 #if defined(NV_LUA_JIT) 65 71 # if NV_PLATFORM == NV_WINDOWS 66 72 # define NV_LUA_PATH "luajit.dll" … … 70 76 # define NV_LUA_PATH "luajit.so" 71 77 # endif 72 #else73 # error "Unrecognized NV_LUA_VERSION!"74 78 #endif 75 79 … … 122 126 # define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX 123 127 # define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) 124 #el se128 #elif NV_LUA_VERSION == NV_LUA_51 125 129 # define LUA_REGISTRYINDEX (-10000) 126 130 # define LUA_ENVIRONINDEX (-10001) 127 131 # define LUA_GLOBALSINDEX (-10002) 128 132 # define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) 133 #else 129 134 #endif 130 135 131 136 #define LUAL_BUFFERSIZE BUFSIZ 132 133 137 134 138 /* Types */ … … 157 161 char short_src[LUA_IDSIZE]; /* (S) */ 158 162 struct CallInfo *i_ci; /* active function */ 159 #el se163 #elif NV_LUA_VERSION == NV_LUA_51 160 164 int nups; 161 165 int linedefined; /* (S) */ … … 163 167 char short_src[LUA_IDSIZE]; /* (S) */ 164 168 int i_ci; /* active function */ 169 #else 165 170 #endif 166 171 }; … … 180 185 char initb[LUAL_BUFFERSIZE]; /* initial buffer */ 181 186 } luaL_Buffer; 182 #el se187 #elif NV_LUA_VERSION == NV_LUA_51 183 188 typedef struct luaL_Buffer { 184 189 char *p; … … 187 192 char initb[LUAL_BUFFERSIZE]; 188 193 } luaL_Buffer; 194 #else 189 195 #endif 190 196 … … 210 216 # define LUA_ERRERR 6 211 217 # define LUA_ERRFILE 7 212 #el se218 #elif NV_LUA_VERSION == NV_LUA_51 213 219 # define LUA_ERRERR 5 214 220 # define LUA_ERRFILE 6 221 #else 215 222 #endif 216 223 … … 280 287 #if NV_LUA_VERSION == NV_LUA_52 281 288 # define LUA_HOOKTAILCALL 4 282 #el se289 #elif NV_LUA_VERSION == NV_LUA_51 283 290 # define LUA_HOOKTAILRET 4 291 #else 284 292 #endif 285 293 … … 291 299 292 300 /* lualib.h defines */ 293 #define LUA_COLIBNAME "coroutine"294 301 #define LUA_TABLIBNAME "table" 295 302 #define LUA_IOLIBNAME "io" … … 300 307 #define LUA_LOADLIBNAME "package" 301 308 #if NV_LUA_VERSION == NV_LUA_52 309 # define LUA_COLIBNAME "coroutine" 302 310 # define LUA_BITLIBNAME "bit32" 303 311 #endif … … 312 320 # define NV_LUA_FUN_51( rtype, fname, fparams ) 313 321 # define NV_LUA_FUN_52 NV_LUA_FUN 314 #el se322 #elif NV_LUA_VERSION == NV_LUA_51 315 323 # define NV_LUA_FUN_51 NV_LUA_FUN 324 # define NV_LUA_FUN_52( rtype, fname, fparams ) 325 #else 326 # define NV_LUA_FUN_51( rtype, fname, fparams ) 316 327 # define NV_LUA_FUN_52( rtype, fname, fparams ) 317 328 #endif … … 347 358 #if NV_LUA_VERSION == NV_LUA_52 348 359 # define lua_pushglobaltable(L) lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS) 349 #el se360 #elif NV_LUA_VERSION == NV_LUA_51 350 361 # define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) 351 362 # define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) 363 #else 352 364 #endif 353 365 … … 378 390 # define luaL_addchar(B,c) ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), ((B)->b[(B)->n++] = (c))) 379 391 # define luaL_addsize(B,s) ((B)->n += (s)) 380 #el se392 #elif NV_LUA_VERSION == NV_LUA_51 381 393 # define luaL_addchar(B,c) ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), (*(B)->p++ = (char)(c))) 382 394 # define luaL_addsize(B,n) ((B)->p += (n)) 395 #else 383 396 #endif 384 397 -
trunk/src/lib/lua.cc
r164 r165 27 27 # define NV_LUA_FUN_51( rtype, fname, fparams ) 28 28 # define NV_LUA_FUN_52 NV_LUA_FUN 29 #elif NV_LUA_VERSION == NV_LUA_51 30 # define NV_LUA_FUN_51 NV_LUA_FUN 31 # define NV_LUA_FUN_52( rtype, fname, fparams ) 29 32 #else 30 # define NV_LUA_FUN_51 NV_LUA_FUN31 # define NV_LUA_FUN_52( rtype, fname, fparams ) 33 # define NV_LUA_FUN_51( rtype, fname, fparams ) 34 # define NV_LUA_FUN_52( rtype, fname, fparams ) 32 35 #endif 33 36 … … 48 51 # define NV_LUA_FUN_51( rtype, fname, fparams ) 49 52 # define NV_LUA_FUN_52 NV_LUA_FUN 53 # elif NV_LUA_VERSION == NV_LUA_51 54 # define NV_LUA_FUN_51 NV_LUA_FUN 55 # define NV_LUA_FUN_52( rtype, fname, fparams ) 50 56 # else 51 # define NV_LUA_FUN_51 NV_LUA_FUN57 # define NV_LUA_FUN_51( rtype, fname, fparams ) 52 58 # define NV_LUA_FUN_52( rtype, fname, fparams ) 53 59 # endif 54 60 55 # include <nv/lib/detail/lua_functions.inc>61 # include <nv/lib/detail/lua_functions.inc> 56 62 57 # undef NV_LUA_FUN58 # undef NV_LUA_FUN_5159 # undef NV_LUA_FUN_5263 # undef NV_LUA_FUN 64 # undef NV_LUA_FUN_51 65 # undef NV_LUA_FUN_52 60 66 return true; 61 67 }
Note: See TracChangeset
for help on using the changeset viewer.