summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:23:43 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:23:43 +0000
commitc594597e3480253f361154c71491adf03bc896d3 (patch)
tree4f656c0861c6ccf00118df41fc5e224bfc4e31b9 /Build/source/texk/web2c/luatexdir
parent352dcc581b20e25d7cc394cf602b3617cd305369 (diff)
LuaTeX: Somewhat better handling of Lua52/LuaJIT
git-svn-id: svn://tug.org/texlive/trunk@34278 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir')
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog12
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lstatslib.c6
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luainit.w57
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h11
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.w30
6 files changed, 37 insertions, 85 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index accf5a718fa..845a1dd3ed2 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,15 @@
+2014-06-02 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * lua/luatex-api.h: Use '#define LUAI_HASHLIMIT 5' as default,
+ as in ../../libs/lua52/lua-5.2.3/src/lstring.c and in
+ ../../libs/luajit/LuaJIT-2.0.3/src/lj_str.c.
+ * lua/lstatslib.c, tex/printing.w: Use LUAI_HASHLIMIT instead of
+ LUATEX_HASHCHARS and LUAJITTEX_HASHCHARS.
+
+ * lua/luatex-api.h: Define MyName as "LuajitTeX"/"LuaTeX" and
+ my_name as "luajittex"/"luatex".
+ * lua/luainit.w, luatex.c, tex/printing.w: Use MyName, my_name.
+
2014-05-14 Peter Breitenlohner <peb@mppmu.mpg.de>
* tex/filename.w: Avoid redefinition of promptfilenamehelpmsg,
diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
index eae0bcb98f4..2d301d7369f 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
@@ -89,11 +89,7 @@ static const char *luatexrevision(void)
static lua_Number get_luatexhashchars(void)
{
-#ifdef LuajitTeX
- return (lua_Number) LUAJITTEX_HASHCHARS;
-#else
- return (lua_Number) LUATEX_HASHCHARS;
-#endif
+ return (lua_Number) LUAI_HASHLIMIT;
}
static const char *get_luatexhashtype(void)
diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w
index c95ecb43867..dbf49093516 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luainit.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w
@@ -53,25 +53,14 @@ and five environment variables:
@c
const_string LUATEX_IHELP[] = {
-#ifdef LuajitTeX
- "Usage: luajittex --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
- " or: luajittex --lua=FILE [OPTION]... \\FIRST-LINE",
- " or: luajittex --lua=FILE [OPTION]... &FMT ARGS",
- " Run LuajitTeX on TEXNAME, usually creating TEXNAME.pdf.",
-#else
- "Usage: luatex --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
- " or: luatex --lua=FILE [OPTION]... \\FIRST-LINE",
- " or: luatex --lua=FILE [OPTION]... &FMT ARGS",
- " Run LuaTeX on TEXNAME, usually creating TEXNAME.pdf.",
-#endif
+ "Usage: " my_name " --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
+ " or: " my_name " --lua=FILE [OPTION]... \\FIRST-LINE",
+ " or: " my_name " --lua=FILE [OPTION]... &FMT ARGS",
+ " Run " MyName " on TEXNAME, usually creating TEXNAME.pdf.",
" Any remaining COMMANDS are processed as luatex input, after TEXNAME is read.",
"",
" Alternatively, if the first non-option argument begins with a backslash,",
-#ifdef LuajitTeX
- " luajittex interprets all non-option arguments as an input line.",
-#else
- " luatex interprets all non-option arguments as an input line.",
-#endif
+ " " my_name " interprets all non-option arguments as an input line.",
"",
" Alternatively, if the first non-option argument begins with a &, the",
" next word is taken as the FMT to read, overriding all else. Any",
@@ -94,11 +83,7 @@ const_string LUATEX_IHELP[] = {
" --fmt=FORMAT load the format file FORMAT",
" --halt-on-error stop processing at the first error",
" --help display help and exit",
-#ifdef LuajitTeX
- " --ini be iniluajittex, for dumping formats",
-#else
- " --ini be iniluatex, for dumping formats",
-#endif
+ " --ini be ini" my_name ", for dumping formats",
" --interaction=STRING set interaction mode (STRING=batchmode/nonstopmode/scrollmode/errorstopmode)",
" --jobname=STRING set the job name to STRING",
" --kpathsea-debug=NUMBER set path searching debugging flags according to the bits of NUMBER",
@@ -419,11 +404,7 @@ static void parse_options(int ac, char **av)
} else if (ARGUMENT_IS("version")) {
print_version_banner();
/* *INDENT-OFF* */
-#ifdef LuajitTeX
- puts("\n\nExecute 'luajittex --credits' for credits and version details.\n\n"
-#else
- puts("\n\nExecute 'luatex --credits' for credits and version details.\n\n"
-#endif
+ puts("\n\nExecute '" my_name " --credits' for credits and version details.\n\n"
"There is NO warranty. Redistribution of this software is covered by\n"
"the terms of the GNU General Public License, version 2 or (at your option)\n"
"any later version. For more information about these matters, see the file\n"
@@ -442,11 +423,7 @@ static void parse_options(int ac, char **av)
print_version_banner();
/* *INDENT-OFF* */
puts("\n\nThe LuaTeX team is Hans Hagen, Hartmut Henkel, Taco Hoekwater.\n"
-#ifdef LuajitTex
- "LuajitTeX merges and builds upon (parts of) the code from these projects:\n\n"
-#else
- "LuaTeX merges and builds upon (parts of) the code from these projects:\n\n"
-#endif
+ MyName " merges and builds upon (parts of) the code from these projects:\n\n"
"tex by Donald Knuth\n"
"etex by Peter Breitenlohner, Phil Taylor and friends\n"
"omega by John Plaice and Yannis Haralambous\n"
@@ -872,33 +849,21 @@ void lua_initialize(int ac, char **av)
static char LC_CTYPE_C[] = "LC_CTYPE=C";
static char LC_COLLATE_C[] = "LC_COLLATE=C";
static char LC_NUMERIC_C[] = "LC_NUMERIC=C";
-#ifdef LuajitTeX
- static char engine_luatex[] = "engine=luajittex";
-#else
- static char engine_luatex[] = "engine=luatex";
-#endif
+ static char engine_luatex[] = "engine=" my_name;
/* Save to pass along to topenin. */
argc = ac;
argv = av;
if (luatex_svn < 0) {
-#ifdef LuajitTeX
- const char *fmt = "This is LuajitTeX, Version %s" WEB2CVERSION;
-#else
- const char *fmt = "This is LuaTeX, Version %s" WEB2CVERSION;
-#endif
+ const char *fmt = "This is " MyName ", Version %s" WEB2CVERSION;
size_t len;
len = strlen(fmt) + strlen(luatex_version_string) ;
banner = xmalloc(len);
sprintf(banner, fmt, luatex_version_string);
} else {
-#ifdef LuajitTeX
- const char *fmt = "This is LuajitTeX, Version %s" WEB2CVERSION " (rev %d)";
-#else
- const char *fmt = "This is LuaTeX, Version %s" WEB2CVERSION " (rev %d)";
-#endif
+ const char *fmt = "This is " MyName ", Version %s" WEB2CVERSION " (rev %d)";
size_t len;
len = strlen(fmt) + strlen(luatex_version_string) + 6;
banner = xmalloc(len);
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index 77792e94b4d..a42b147c301 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
@@ -30,6 +30,11 @@
# include "lualib.h"
#ifdef LuajitTeX
# include "luajit.h"
+# define MyName "LuajitTeX"
+# define my_name "luajittex"
+#else
+# define MyName "LuaTeX"
+# define my_name "luatex"
#endif
#ifdef __cplusplus
@@ -135,10 +140,8 @@ extern char *jithash_hashname ;
#endif
-#ifdef LuajitTeX
-#define LUAJITTEX_HASHCHARS 6 /* todo: It must be like that one on lj_str.c */
-#else
-#define LUATEX_HASHCHARS 6 /* todo: It must be LUAI_HASHLIMIT! */
+#if !defined(LUAI_HASHLIMIT)
+#define LUAI_HASHLIMIT 5
#endif
extern unsigned char show_luahashchars ;
diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c
index fb655167849..b98c250493b 100644
--- a/Build/source/texk/web2c/luatexdir/luatex.c
+++ b/Build/source/texk/web2c/luatexdir/luatex.c
@@ -26,11 +26,7 @@ int luatex_version = 79; /* \.{\\luatexversion} */
int luatex_revision = '1'; /* \.{\\luatexrevision} */
int luatex_date_info = 2014040100; /* the compile date is now hardwired */
const char *luatex_version_string = "beta-0.79.1";
-#ifdef LuajitTeX
-const char *engine_name = "luajittex"; /* the name of this engine */
-#else
-const char *engine_name = "luatex"; /* the name of this engine */
-#endif
+const char *engine_name = my_name; /* the name of this engine */
#include <kpathsea/c-ctype.h>
#include <kpathsea/line.h>
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w
index 53bd0c79a8a..9b2404c0196 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.w
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.w
@@ -462,28 +462,16 @@ void print_banner(const char *v, int ver)
callback_id = callback_defined(start_run_callback);
if (callback_id == 0) {
if (ver < 0)
-#ifdef LuajitTeX
- fprintf(term_out, "This is LuajitTeX, Version %s ", v);
-#else
- fprintf(term_out, "This is LuaTeX, Version %s ", v);
-#endif
+ fprintf(term_out, "This is " MyName ", Version %s ", v);
else
-#ifdef LuajitTeX
- fprintf(term_out, "This is LuajitTeX, Version %s%s (rev %d) ", v,
-#else
- fprintf(term_out, "This is LuaTeX, Version %s%s (rev %d) ", v,
-#endif
+ fprintf(term_out, "This is " MyName ", Version %s%s (rev %d) ", v,
WEB2CVERSION, ver);
if (format_ident > 0)
print(format_ident);
print_ln();
if (show_luahashchars){
wterm(' ');
-#ifdef LuajitTeX
- fprintf(term_out,"Number of bits used by the hash function (luajittex): %d",LUAJITTEX_HASHCHARS);
-#else
- fprintf(term_out,"Number of bits used by the hash function (luatex): %d",LUATEX_HASHCHARS);
-#endif
+ fprintf(term_out,"Number of bits used by the hash function (" my_name "): %d",LUAI_HASHLIMIT);
print_ln();
}
if (shellenabledp) {
@@ -508,17 +496,9 @@ void log_banner(const char *v, int ver)
if (month > 12)
month = 0;
if (ver < 0)
-#ifdef LuajitTeX
- fprintf(log_file, "This is LuajitTeX, Version %s ", v);
-#else
- fprintf(log_file, "This is LuaTeX, Version %s ", v);
-#endif
+ fprintf(log_file, "This is " MyName ", Version %s ", v);
else
-#ifdef LuajitTeX
- fprintf(log_file, "This is LuajitTeX, Version %s%s (rev %d) ", v,
-#else
- fprintf(log_file, "This is LuaTeX, Version %s%s (rev %d) ", v,
-#endif
+ fprintf(log_file, "This is " MyName ", Version %s%s (rev %d) ", v,
WEB2CVERSION, ver);
print(format_ident);
print_char(' ');