summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lua
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-03-25 12:44:48 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-03-25 12:44:48 +0000
commitfa3e48ffa8e9e44b7d15902701f839babbfb6421 (patch)
tree9747ef1145378f1c7399ffddf1f413edfb43d391 /Build/source/texk/web2c/luatexdir/lua
parentd9b87d6ab23197117e56d07a09b0f0d9cf7be572 (diff)
web2c/luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@40135 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c34
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdflib.c62
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h3
3 files changed, 80 insertions, 19 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index d9a5569fc38..a5112385195 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -1932,7 +1932,9 @@ static int lua_nodelib_is_char(lua_State * L)
{
halfword n = *(check_isnode(L, 1));
if (type(n) != glyph_node) {
- lua_pushnil(L); /* no glyph at all */
+ lua_pushnil(L); /* no glyph at all */
+ lua_pushinteger(L,type(n)); /* can save a lookup call */
+ return 2;
} else if (subtype(n) >= 256) {
lua_pushboolean(L,0); /* a done glyph */
} else if (lua_type(L,2) == LUA_TNUMBER) {
@@ -1948,6 +1950,19 @@ static int lua_nodelib_is_char(lua_State * L)
return 1;
}
+static int lua_nodelib_is_glyph(lua_State * L)
+{
+ halfword n = *(check_isnode(L, 1));
+ if (type(n) != glyph_node) {
+ lua_pushboolean(L,0);
+ lua_pushinteger(L,type(n));
+ } else {
+ lua_pushinteger(L,character(n));
+ lua_pushinteger(L,font(n));
+ }
+ return 2;
+}
+
/* node.direct.has_field */
static int lua_nodelib_direct_has_field(lua_State * L)
@@ -5847,6 +5862,8 @@ static int lua_nodelib_direct_is_char(lua_State * L)
halfword n = lua_tointeger(L, 1);
if (type(n) != glyph_node) {
lua_pushnil(L); /* no glyph at all */
+ lua_pushinteger(L,type(n)); /* can save a lookup call */
+ return 2;
} else if (subtype(n) >= 256) {
lua_pushboolean(L,0); /* a done glyph */
} else if (lua_type(L,2) == LUA_TNUMBER) {
@@ -5862,6 +5879,19 @@ static int lua_nodelib_direct_is_char(lua_State * L)
return 1;
}
+static int lua_nodelib_direct_is_glyph(lua_State * L)
+{
+ halfword n = lua_tointeger(L, 1);
+ if (type(n) != glyph_node) {
+ lua_pushboolean(L,0);
+ lua_pushinteger(L,type(n));
+ } else {
+ lua_pushinteger(L,character(n));
+ lua_pushinteger(L,font(n));
+ }
+ return 2;
+}
+
static int lua_nodelib_direct_setdiscretionary(lua_State * L)
{
halfword n = lua_tointeger(L, 1);
@@ -6752,6 +6782,7 @@ static const struct luaL_Reg direct_nodelib_f[] = {
{"get_attribute", lua_nodelib_direct_get_attribute},
{"has_field", lua_nodelib_direct_has_field},
{"is_char", lua_nodelib_direct_is_char},
+ {"is_glyph", lua_nodelib_direct_is_glyph},
{"hpack", lua_nodelib_direct_hpack},
/* {"id", lua_nodelib_id}, */ /* no node argument */
{"insert_after", lua_nodelib_direct_insert_after},
@@ -6842,6 +6873,7 @@ static const struct luaL_Reg nodelib_f[] = {
{"get_attribute", lua_nodelib_get_attribute},
{"has_field", lua_nodelib_has_field},
{"is_char", lua_nodelib_is_char},
+ {"is_glyph", lua_nodelib_is_glyph},
{"hpack", lua_nodelib_hpack},
{"id", lua_nodelib_id},
{"insert_after", lua_nodelib_insert_after},
diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
index 29bfba6baf3..7991f234f0e 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
@@ -506,6 +506,23 @@ static int l_registerannot(lua_State * L)
return 0;
}
+/*
+
+# define valid_pdf_key ( \
+ lua_key_eq(s,pageresources) \
+ lua_key_eq(s,pageattributes) || \
+ lua_key_eq(s,pagesattributes) || \
+ lua_key_eq(s,catalog) || \
+ lua_key_eq(s,info) || \
+ lua_key_eq(s,names) || \
+ lua_key_eq(s,trailer) || \
+ lua_key_eq(s,xformresources) || \
+ lua_key_eq(s,xformattributes) || \
+ lua_key_eq(s,trailerid) \
+)
+
+*/
+
#define l_get_pdf_value(key) \
lua_get_metatablelua(pdf_data); \
lua_key_rawgeti(key); \
@@ -520,20 +537,12 @@ static int l_get_names (lua_State * L) { l_get_pdf_value(names); }
static int l_get_trailer (lua_State * L) { l_get_pdf_value(trailer); }
static int l_get_xformresources (lua_State * L) { l_get_pdf_value(xformresources); }
static int l_get_xformattributes(lua_State * L) { l_get_pdf_value(xformattributes); }
+static int l_get_trailerid (lua_State * L) { l_get_pdf_value(trailerid); }
-# define valid_pdf_key ( \
- lua_key_eq(s,catalog) || \
- lua_key_eq(s,info) || \
- lua_key_eq(s,trailer) || \
- lua_key_eq(s,names) || \
- lua_key_eq(s,pageattributes) || \
- lua_key_eq(s,pagesattributes) || \
- lua_key_eq(s,pageresources) \
-)
+/*
static int getpdf(lua_State * L)
{
- /* [pdf table] [key] */
const char *s ;
if (lua_gettop(L) != 2) {
return 0;
@@ -548,15 +557,14 @@ static int getpdf(lua_State * L)
return 1;
} else if (valid_pdf_key) {
lua_get_metatablelua(pdf_data);
- /* [pdf table] [key] [pdf.data table] */
lua_replace(L, -3);
- /* [pdf.data table] [key] */
lua_rawget(L, -2);
return 1;
}
}
return 0;
}
+*/
#define l_set_pdf_value(key) \
if (lua_type(L,-1) == LUA_TSTRING) { \
@@ -576,10 +584,12 @@ static int l_set_names (lua_State * L) { l_set_pdf_value(names); }
static int l_set_trailer (lua_State * L) { l_set_pdf_value(trailer); }
static int l_set_xformresources (lua_State * L) { l_set_pdf_value(xformresources); }
static int l_set_xformattributes(lua_State * L) { l_set_pdf_value(xformattributes); }
+static int l_set_trailerid (lua_State * L) { l_set_pdf_value(trailerid); }
+
+/*
static int setpdf(lua_State * L)
{
- /* [pdf table] [key] [value] */
const char *s ;
if (lua_gettop(L) != 3) {
return 0;
@@ -588,15 +598,15 @@ static int setpdf(lua_State * L)
s = lua_tostring(L, -1);
if (valid_pdf_key) {
lua_get_metatablelua(pdf_data);
- /* [pdf table] [key] [value] [pdf.data table] */
lua_replace(L, -4);
- /* [pdf.data table] [key] [value] */
}
}
lua_rawset(L, -3);
return 0;
}
+*/
+
static int l_objtype(lua_State * L)
{
int n = lua_gettop(L);
@@ -1008,6 +1018,18 @@ static int getpdfignoreunknownimages(lua_State * L) {
return 1;
}
+ static int l_set_suppress_optional_info(lua_State * L) {
+ if (lua_type(L, 1) == LUA_TNUMBER) {
+ set_tex_extension_count_register(c_pdf_suppress_optional_info,lua_tointeger(L, 1));
+ }
+ return 0;
+}
+
+static int l_get_suppress_optional_info(lua_State * L) {
+ lua_pushinteger(L,get_tex_extension_count_register(c_pdf_suppress_optional_info));
+ return 1;
+}
+
static int newpdfcolorstack(lua_State * L)
{
const char *s = NULL;
@@ -1064,6 +1086,7 @@ static const struct luaL_Reg pdflib[] = {
{ "setpagesattributes", l_set_pagesattributes },
{ "setxformresources", l_set_xformresources },
{ "setxformattributes", l_set_xformattributes },
+ { "settrailerid", l_set_trailerid },
{ "getcatalog", l_get_catalog },
{ "getinfo", l_get_info },
{ "getnames", l_get_names },
@@ -1073,6 +1096,7 @@ static const struct luaL_Reg pdflib[] = {
{ "getpagesattributes", l_get_pagesattributes },
{ "getxformresources", l_get_xformresources },
{ "getxformattributes", l_get_xformattributes },
+ { "gettrailerid", l_get_trailerid },
{ "getlastlink", l_get_lastlink },
{ "getretval", l_get_retval },
{ "getlastobj", l_get_lastobj },
@@ -1085,6 +1109,8 @@ static const struct luaL_Reg pdflib[] = {
{ "setdecimaldigits", l_set_decimal_digits },
{ "getpkresolution", l_get_pk_resolution },
{ "setpkresolution", l_set_pk_resolution },
+ { "getsuppressoptionalinfo", l_get_suppress_optional_info },
+ { "setsuppressoptionalinfo", l_set_suppress_optional_info },
/* moved from tex table */
{ "fontname", getpdffontname },
{ "fontobjnum", getpdffontobjnum },
@@ -1121,15 +1147,15 @@ int luaopen_pdf(lua_State * L)
lua_settable(L,LUA_REGISTRYINDEX);
/* */
luaL_register(L, "pdf", pdflib);
- /* build meta table */
+ /*
luaL_newmetatable(L, "pdf.meta");
lua_pushstring(L, "__index");
lua_pushcfunction(L, getpdf);
- /* do these later, NYI */
lua_settable(L, -3);
lua_pushstring(L, "__newindex");
lua_pushcfunction(L, setpdf);
lua_settable(L, -3);
- lua_setmetatable(L, -2); /* meta to itself */
+ lua_setmetatable(L, -2);
+ */
return 1;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index 163d5577410..8802253c199 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
@@ -794,6 +794,7 @@ make_lua_key(top_right);\
make_lua_key(tounicode);\
make_lua_key(tracingparagraphs);\
make_lua_key(trailer);\
+make_lua_key(trailerid);\
make_lua_key(transform);\
make_lua_key(trim);\
make_lua_key(type);\
@@ -1148,6 +1149,7 @@ init_lua_key(top_right);\
init_lua_key(tounicode);\
init_lua_key(tracingparagraphs);\
init_lua_key(trailer);\
+init_lua_key(trailerid);\
init_lua_key(transform);\
init_lua_key(trim);\
init_lua_key(type);\
@@ -1570,6 +1572,7 @@ use_lua_key(top_right);
use_lua_key(tounicode);
use_lua_key(tracingparagraphs);
use_lua_key(trailer);
+use_lua_key(trailerid);
use_lua_key(transform);
use_lua_key(trim);
use_lua_key(type);