History

Lua 5.3.0-rc1

Lua Team committed 11 years ago

Commit 39602181 parent 17ba7315 files · +61 −49Browse files

Showing the changes to src (2 of 5 files). Show all

Unified · Split

2 files
  1. src/lauxlib.c +11 −2
  2. src/luaconf.h +27 −26
src/lauxlib.c+11−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lauxlib.c,v 1.277 2014/12/10 11:31:32 roberto Exp $2** $Id: lauxlib.c,v 1.279 2014/12/14 18:32:26 roberto Exp $
3** Auxiliary functions for building Lua libraries3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -66,11 +66,20 @@ static int findfield (lua_State *L, int objidx, int level) { · 60 unmodified lines
66}66}
67 67
68 68
69/*
70** Search for a name for a function in all loaded modules
71** (registry._LOADED).
72*/
69static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {73static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
70 int top = lua_gettop(L);74 int top = lua_gettop(L);
71 lua_getinfo(L, "f", ar); /* push function */75 lua_getinfo(L, "f", ar); /* push function */
72 lua_pushglobaltable(L);76 lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
73 if (findfield(L, top + 1, 2)) {77 if (findfield(L, top + 1, 2)) {
78 const char *name = lua_tostring(L, -1);
79 if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */
80 lua_pushstring(L, name + 3); /* push name without prefix */
81 lua_remove(L, -2); /* remove original name */
82 }
74 lua_copy(L, -1, top + 1); /* move name to proper place */83 lua_copy(L, -1, top + 1); /* move name to proper place */
75 lua_pop(L, 2); /* remove pushed values */84 lua_pop(L, 2); /* remove pushed values */
76 return 1;85 return 1;
src/luaconf.h+27−26
@@ -1,12 +1,12 @@
1/*1/*
2** $Id: luaconf.h,v 1.231 2014/12/10 11:56:55 roberto Exp $2** $Id: luaconf.h,v 1.235 2014/12/16 17:17:30 roberto Exp $
3** Configuration file for Lua3** Configuration file for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
6 6
7 7
8#ifndef lconfig_h8#ifndef luaconf_h
9#define lconfig_h9#define luaconf_h
10 10
11#include <limits.h>11#include <limits.h>
12#include <stddef.h>12#include <stddef.h>
@@ -20,18 +20,18 @@ · 7 unmodified lines
20 20
21 21
22/*22/*
23** {==================================================================23** {====================================================================
24** System Configuration: macros to adapt (if needed) Lua to some24** System Configuration: macros to adapt (if needed) Lua to some
25** particular platform, for instance compiling it as Small Lua (3225** particular platform, for instance compiling it with 32-bit numbers or
26** bits) or restricting it to C89.26** restricting it to C89.
27** ===================================================================27** =====================================================================
28*/28*/
29 29
30/*30/*
31@@ LUA_32BITS enables Small Lua (that is, Lua with 32-bit integers31@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You
32** and 32-bit floats). You can also define LUA_32BITS in the make file,32** can also define LUA_32BITS in the make file, but changing here you
33** but changing here you ensure that all software connected to Lua will33** ensure that all software connected to Lua will be compiled with the
34** be compiled with the same configuration.34** same configuration.
35*/35*/
36/* #define LUA_32BITS */36/* #define LUA_32BITS */
37 37
@@ -74,8 +74,8 @@ · 36 unmodified lines
74 74
75/*75/*
76@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for76@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
77** C89 ('long' and 'double'); Windows has '__int64', so it does not need77** C89 ('long' and 'double'); Windows always has '__int64', so it does
78** to use this case.78** not need to use this case.
79*/79*/
80#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)80#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
81#define LUA_C89_NUMBERS81#define LUA_C89_NUMBERS
@@ -102,8 +102,8 @@ · 20 unmodified lines
102** the type for Lua floats.102** the type for Lua floats.
103** Lua should work fine with any mix of these options (if supported103** Lua should work fine with any mix of these options (if supported
104** by your C compiler). The usual configurations are 64-bit integers104** by your C compiler). The usual configurations are 64-bit integers
105** and 'double' (the default), 32-bit integers and 'float' (Small Lua,105** and 'double' (the default), 32-bit integers and 'float' (for
106** for restricted platforms), and 'long'/'double' (for C compilers not106** restricted platforms), and 'long'/'double' (for C compilers not
107** compliant with C99, which may not have support for 'long long').107** compliant with C99, which may not have support for 'long long').
108*/108*/
109 109
@@ -127,8 +127,7 @@ · 17 unmodified lines
127 127
128#else /* }{ */128#else /* }{ */
129/*129/*
130** default configuration for 64-bit Lua ('long long' and 'double');130** default configuration for 64-bit Lua ('long long' and 'double')
131** Windows will use '__int64'
132*/131*/
133#define LUA_INT_LONGLONG132#define LUA_INT_LONGLONG
134#define LUA_REAL_DOUBLE133#define LUA_REAL_DOUBLE
@@ -565,7 +564,17 @@ · 430 unmodified lines
565 564
566#elif defined(LUA_INT_LONGLONG) /* }{ long long */565#elif defined(LUA_INT_LONGLONG) /* }{ long long */
567 566
568#if defined(LUA_USE_WINDOWS) /* { */567#if defined(LLONG_MAX) /* { */
568/* use ISO C99 stuff */
569
570#define LUA_INTEGER long long
571#define LUA_INTEGER_FRMLEN "ll"
572
573#define LUA_MAXINTEGER LLONG_MAX
574#define LUA_MININTEGER LLONG_MIN
575
576#elif defined(LUA_USE_WINDOWS) /* }{ */
577/* in Windows, can use specific Windows types */
569 578
570#define LUA_INTEGER __int64579#define LUA_INTEGER __int64
571#define LUA_INTEGER_FRMLEN "I64"580#define LUA_INTEGER_FRMLEN "I64"
@@ -575,16 +584,8 @@ · 3 unmodified lines
575 584
576#else /* }{ */585#else /* }{ */
577 586
578#if !defined(LLONG_MAX)
579#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \587#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
580 or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"588 or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
581#endif
582
583#define LUA_INTEGER long long
584#define LUA_INTEGER_FRMLEN "ll"
585
586#define LUA_MAXINTEGER LLONG_MAX
587#define LUA_MININTEGER LLONG_MIN
588 589
589#endif /* } */590#endif /* } */
590 591