diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2010-04-04 13:55:46 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2010-04-04 13:55:46 +0000 |
commit | f372862c42d234710b6057449b46818e63181c90 (patch) | |
tree | a9ebec66dd31ac37aed442502ebd1b9fe76245ec /Build/source/texk/web2c/luatexdir/lua51 | |
parent | 2dad291ab056f30816e0aea61970f38033c2f6a5 (diff) |
import luatex 0.60.0 (with small local changes, see luatexdir/ChangeLog)
and do an autoreconf
git-svn-id: svn://tug.org/texlive/trunk@17680 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua51')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua51/lcoco.c | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua51/loadlib.c | 23 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua51/luaconf.h | 35 |
3 files changed, 49 insertions, 11 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua51/lcoco.c b/Build/source/texk/web2c/luatexdir/lua51/lcoco.c index 45080285eae..2a234edbfc7 100644 --- a/Build/source/texk/web2c/luatexdir/lua51/lcoco.c +++ b/Build/source/texk/web2c/luatexdir/lua51/lcoco.c @@ -468,7 +468,7 @@ typedef void (*coco_MainFunc)(void); /* Don't use multiples of 64K to avoid D-cache aliasing conflicts. */ #ifndef COCO_DEFAULT_CSTACKSIZE -#define COCO_DEFAULT_CSTACKSIZE (65536-4096) +#define COCO_DEFAULT_CSTACKSIZE ((16*65536)-4096) #endif static int defaultcstacksize = COCO_DEFAULT_CSTACKSIZE; diff --git a/Build/source/texk/web2c/luatexdir/lua51/loadlib.c b/Build/source/texk/web2c/luatexdir/lua51/loadlib.c index 0d401eba1cf..ea62dff7a16 100644 --- a/Build/source/texk/web2c/luatexdir/lua51/loadlib.c +++ b/Build/source/texk/web2c/luatexdir/lua51/loadlib.c @@ -410,6 +410,14 @@ static int loader_C (lua_State *L) { return 1; /* library loaded successfully */ } +int loader_C_luatex (lua_State *L, const char *name, const char *filename) { + const char *funcname; + funcname = mkfuncname(L, name); + if (ll_loadfunc(L, filename, funcname) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + static int loader_Croot (lua_State *L) { const char *funcname; @@ -431,6 +439,21 @@ static int loader_Croot (lua_State *L) { return 1; } +int loader_Call_luatex (lua_State *L, const char *name, const char *filename) { + const char *funcname; + int stat; + if (filename == NULL) return 1; /* root not found */ + funcname = mkfuncname(L, name); + if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { + if (stat != ERRFUNC) loaderror(L, filename); /* real error */ + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); + return 1; /* function not found */ + } + return 1; /* library loaded successfully */ +} + + static int loader_preload (lua_State *L) { const char *name = luaL_checkstring(L, 1); diff --git a/Build/source/texk/web2c/luatexdir/lua51/luaconf.h b/Build/source/texk/web2c/luatexdir/lua51/luaconf.h index 0650f2c7f64..fac58d8cb5c 100644 --- a/Build/source/texk/web2c/luatexdir/lua51/luaconf.h +++ b/Build/source/texk/web2c/luatexdir/lua51/luaconf.h @@ -11,6 +11,7 @@ #include <limits.h> #include <stddef.h> +#include <web2c/c-auto.h> /* ** ================================================================== @@ -44,6 +45,11 @@ #define LUA_DL_DYLD /* does not need extra library */ #endif +#if !defined(_WIN32) +#if defined(HAVE_DLFCN_H) +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#endif +#endif /* @@ -521,15 +527,23 @@ #define LUA_NUMBER_SCAN "%lf" #define LUA_NUMBER_FMT "%.14g" -#define lua_number2str(s,n) if (((n)<0.000001) && ((n)>-0.000001)) \ - sprintf((s), "0"); else if (((n)<0.0001) && ((n)>-0.0001)) { \ - sprintf((s), "%.6f", (n)); \ - if (n>0) { if (s[7] == '0') { s[7] = 0; } } \ - else { if (s[8] == '0') { s[8] = 0; } } \ - } else sprintf((s), LUA_NUMBER_FMT, (n)); - - -#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define lua_number2str(s,n) do { \ + if (n<0.0001 && n>=-0.0001) { \ + sprintf((s), "%.14f", (n)); \ + if (strchr(s,'.')) { \ + size_t s_l ; \ + s_l = strlen(s); \ + while (s_l>0 && s_l--) { \ + if (s[s_l] == '0') s[s_l] = '\0'; \ + else break; \ + } \ + if (s[s_l] == '.') s[s_l] = '\0'; \ + } \ + } else sprintf((s), LUA_NUMBER_FMT, (n)); \ + } while (0) + + +#define LUAI_MAXNUMBER2STR 64 /* 16 digits, sign, point, and \0 */ #define lua_str2number(s,p) strtod((s), (p)) @@ -568,7 +582,8 @@ /* On a Microsoft compiler, use assembler */ #if defined(_MSC_VER) -#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2int(i,d) \ +{int N__; double D__=d; {__asm fld D__ __asm fistp N__} i = N__;} #define lua_number2integer(i,n) lua_number2int(i, n) /* the next trick should work on any Pentium, but sometimes clashes |