summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lua
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexlib.c47
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luainit.w5
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luajitstuff.w23
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h11
4 files changed, 60 insertions, 26 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
index 872b2994e23..03a97288a86 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
@@ -202,6 +202,39 @@ static int luacsprint(lua_State * L)
return do_luacprint(L, PARTIAL_LINE, DEFAULT_CAT_TABLE);
}
+static int luaccprint(lua_State * L)
+{
+ /* so a negative value is a specific catcode with offset 1 */
+ int cattable = lua_tointeger(L,1);
+ if (cattable < 0 || cattable > 15) {
+ cattable = - 12 - 0xFF ;
+ } else {
+ cattable = - cattable - 0xFF;
+ }
+ if (lua_type(L, 2) == LUA_TTABLE) {
+ int i;
+ for (i = 1;; i++) {
+ lua_rawgeti(L, 2, i);
+ if (lua_isstring(L,-1)) { /* or number */
+ luac_store(L, -1, PARTIAL_LINE, cattable);
+ lua_pop(L, 1);
+ } else {
+ break;
+ }
+ }
+ } else {
+ int i;
+ int n = lua_gettop(L);
+ for (i = 2; i <= n; i++) {
+ if (!lua_isstring(L,1)) { /* or number */
+ luaL_error(L, "no string to print");
+ }
+ luac_store(L, i, PARTIAL_LINE, cattable);
+ }
+ }
+ return 0;
+}
+
static int luactprint(lua_State * L)
{
int i, j;
@@ -1827,6 +1860,14 @@ static int getlist(lua_State * L)
alink(vlink(contrib_head)) = null ;
lua_pushinteger(L, vlink(contrib_head));
lua_nodelib_push(L);
+ } else if (lua_key_eq(str,page_discards_head)) {
+ alink(vlink(page_disc)) = null ;
+ lua_pushinteger(L, page_disc);
+ lua_nodelib_push(L);
+ } else if (lua_key_eq(str,split_discards_head)) {
+ alink(vlink(split_disc)) = null ;
+ lua_pushinteger(L, split_disc);
+ lua_nodelib_push(L);
} else if (lua_key_eq(str,page_head)) {
alink(vlink(page_head)) = null ;/*hh-ls */
lua_pushinteger(L, vlink(page_head));
@@ -1903,6 +1944,10 @@ static int setlist(lua_State * L)
page_tail = (n == 0 ? page_head : tail_of_list(n));
} else if (lua_key_eq(str,temp_head)) {
vlink(temp_head) = n;
+ } else if (lua_key_eq(str,page_discards_head)) {
+ page_disc = n;
+ } else if (lua_key_eq(str,split_discards_head)) {
+ split_disc = n;
} else if (lua_key_eq(str,hold_head)) {
vlink(hold_head) = n;
} else if (lua_key_eq(str,adjust_head)) {
@@ -2597,7 +2642,6 @@ static int tex_run_boot(lua_State * L)
unhide_lua_table(Luas, "tex", tex_table_id);
unhide_lua_table(Luas, "pdf", pdf_table_id);
unhide_lua_table(Luas, "token", token_table_id);
- unhide_lua_table(Luas, "oldtoken", oldtoken_table_id);
unhide_lua_table(Luas, "node", node_table_id);
lua_pushboolean(L, 1); /* true */
@@ -2824,6 +2868,7 @@ static const struct luaL_Reg texlib[] = {
{ "write", luacwrite },
{ "print", luacprint },
{ "tprint", luactprint },
+ { "cprint", luaccprint },
{ "error", texerror },
{ "sprint", luacsprint },
{ "set", settex },
diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w
index 016501df6c3..75559f9a403 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luainit.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w
@@ -399,7 +399,7 @@ static void parse_options(int ac, char **av)
/* Synchronize TeXnology: catching the command line option as a long */
synctexoption = (int) strtol(optarg, NULL, 0);
} else if (ARGUMENT_IS("recorder")) {
- recorderoption = 1 ;
+ recorderoption = 1 ;
} else if (ARGUMENT_IS("help")) {
usagehelp(LUATEX_IHELP, BUG_ADDRESS);
} else if (ARGUMENT_IS("version")) {
@@ -759,7 +759,6 @@ static void setup_lua_path(lua_State * L)
int tex_table_id;
int pdf_table_id;
int token_table_id;
-int oldtoken_table_id;
int node_table_id;
@ @c
@@ -955,7 +954,6 @@ void lua_initialize(int ac, char **av)
/* hide the 'tex' and 'pdf' table */
tex_table_id = hide_lua_table(Luas, "tex");
token_table_id = hide_lua_table(Luas, "token");
- oldtoken_table_id = hide_lua_table(Luas, "oldtoken");
node_table_id = hide_lua_table(Luas, "node");
pdf_table_id = hide_lua_table(Luas, "pdf");
@@ -988,7 +986,6 @@ void lua_initialize(int ac, char **av)
unhide_lua_table(Luas, "tex", tex_table_id);
unhide_lua_table(Luas, "pdf", pdf_table_id);
unhide_lua_table(Luas, "token", token_table_id);
- unhide_lua_table(Luas, "oldtoken", oldtoken_table_id);
unhide_lua_table(Luas, "node", node_table_id);
/* |kpse_init| */
diff --git a/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w b/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w
index e19338027b0..f219d5bd654 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w
@@ -22,6 +22,7 @@
#include "lua/luatex-api.h"
#include "lua/lauxlib_bridge.h"
+
@ @c
lua_State *Luas = NULL;
@@ -161,23 +162,13 @@ static void do_openlibs(lua_State * L)
}
}
-@ @c
-static int load_aux (lua_State *L, int status) {
- if (status == 0) /* OK? */
- return 1;
- else {
- lua_pushnil(L);
- lua_insert(L, -2); /* put before error message */
- return 2; /* return nil plus error message */
- }
-}
@ @c
static int luatex_loadfile (lua_State *L) {
int status = 0;
const char *fname = luaL_optstring(L, 1, NULL);
const char *mode = luaL_optstring(L, 2, NULL);
- int env = !lua_isnone(L, 3); /* 'env' parameter? */
+ /*int env = !lua_isnone(L, 3);*/ /* 'env' parameter? */
if (!lua_only && !fname && interaction == batch_mode) {
lua_pushnil(L);
lua_pushstring(L, "reading from stdin is disabled in batch mode");
@@ -186,12 +177,12 @@ static int luatex_loadfile (lua_State *L) {
status = luaL_loadfilex(L, fname, mode);
if (status == LUA_OK) {
recorder_record_input(fname);
- if (env) { /* 'env' parameter? */
- lua_pushvalue(L, 3);
- lua_setupvalue(L, -2, 1); /* set it as 1st upvalue of loaded chunk */
- }
+ /* if (env) { *//* 'env' parameter? */
+ /* lua_pushvalue(L, 3); */
+ /* lua_setupvalue(L, -2, 1); *//* set it as 1st upvalue of loaded chunk */
+ /*} */
}
- return load_aux(L, status);
+ return RESERVED_load_aux_JIT(L, status,3);
}
@ @c
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index c67522c06fc..5154a5d303d 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
@@ -128,7 +128,6 @@ extern int luaopen_vf(lua_State * L);
extern int font_to_lua(lua_State * L, int f);
extern int font_from_lua(lua_State * L, int f); /* return is boolean */
-extern int luaopen_oldtoken(lua_State * L);
extern int luaopen_token(lua_State * L);
extern void tokenlist_to_lua(lua_State * L, int p);
extern void tokenlist_to_luastring(lua_State * L, int p);
@@ -218,7 +217,6 @@ extern void init_tex_table(lua_State * L);
extern int tex_table_id;
extern int pdf_table_id;
extern int token_table_id;
-extern int oldtoken_table_id;
extern int node_table_id;
extern int main_initialize(void);
@@ -596,7 +594,6 @@ make_lua_key(lua);\
make_lua_key(lua_functions);\
make_lua_key(luatex);\
make_lua_key(luatex_node);\
-make_lua_key(luatex_oldtoken);\
make_lua_key(luatex_token);\
make_lua_key(mLTL);\
make_lua_key(mRTT);\
@@ -646,6 +643,7 @@ make_lua_key(pTLT);\
make_lua_key(pTRT);\
make_lua_key(page);\
make_lua_key(pages);\
+make_lua_key(page_discards_head);\
make_lua_key(page_head);\
make_lua_key(page_ins_head);\
make_lua_key(pageattributes);\
@@ -710,6 +708,7 @@ make_lua_key(space_stretch);\
make_lua_key(spacefactor);\
make_lua_key(spec);\
make_lua_key(special);\
+make_lua_key(split_discards_head);\
make_lua_key(split_keep);\
make_lua_key(split_off);\
make_lua_key(stack);\
@@ -933,7 +932,6 @@ init_lua_key(lua);\
init_lua_key(lua_functions);\
init_lua_key(luatex);\
init_lua_key(luatex_node);\
-init_lua_key(luatex_oldtoken);\
init_lua_key(luatex_token);\
init_lua_key(marginkern);\
init_lua_key(mark);\
@@ -973,6 +971,7 @@ init_lua_key(output);\
init_lua_key(overlay_accent);\
init_lua_key(page);\
init_lua_key(pages);\
+init_lua_key(page_discards_head);\
init_lua_key(page_head);\
init_lua_key(page_ins_head);\
init_lua_key(pageattributes);\
@@ -1036,6 +1035,7 @@ init_lua_key(space_stretch);\
init_lua_key(spacefactor);\
init_lua_key(spec);\
init_lua_key(special);\
+init_lua_key(split_discards_head);\
init_lua_key(split_keep);\
init_lua_key(split_off);\
init_lua_key(stack);\
@@ -1315,7 +1315,6 @@ use_lua_key(lua);
use_lua_key(lua_functions);
use_lua_key(luatex);
use_lua_key(luatex_node);
-use_lua_key(luatex_oldtoken);
use_lua_key(luatex_token);
use_lua_key(mLTL);
use_lua_key(mRTT);
@@ -1365,6 +1364,7 @@ use_lua_key(pTLT);
use_lua_key(pTRT);
use_lua_key(page);
use_lua_key(pages);
+use_lua_key(page_discards_head);
use_lua_key(page_head);
use_lua_key(page_ins_head);
use_lua_key(pagebox);
@@ -1429,6 +1429,7 @@ use_lua_key(space_stretch);
use_lua_key(spacefactor);
use_lua_key(spec);
use_lua_key(special);
+use_lua_key(split_discards_head);
use_lua_key(split_keep);
use_lua_key(split_off);
use_lua_key(stack);