summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lua
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2020-04-21 18:43:36 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2020-04-21 18:43:36 +0000
commit7c0b908f1a6e1489834fbdb0789766eed8a37b49 (patch)
treecb55d631b861bfcf95fe853713af6f760227ba0f /Build/source/texk/web2c/luatexdir/lua
parente783b071ded7eef421d0333416b47142bc5542cb (diff)
pplib under libs -- WORK IN PROGRSS grep '?' out
git-svn-id: svn://tug.org/texlive/trunk@54824 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c12
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdfelib.c41
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.c2
3 files changed, 46 insertions, 9 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index d5ab00a5541..7e76746037b 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -8403,10 +8403,11 @@ static int lua_nodelib_properties_get_table(lua_State * L)
static int lua_nodelib_get_property_t(lua_State * L)
{ /* <table> <node> */
halfword n = *((halfword *) lua_touserdata(L, 2));
- if (n == null) {
- lua_pushnil(L);
+ if (n != null) {
+ lua_get_metatablelua(node_properties);
+ lua_rawgeti(L, -1, n);
} else {
- lua_rawgeti(L,1,n);
+ lua_pushnil(L);
}
return 1;
}
@@ -8416,8 +8417,9 @@ static int lua_nodelib_set_property_t(lua_State * L)
/* <table> <node> <value> */
halfword n = *((halfword *) lua_touserdata(L, 2));
if (n != null) {
- lua_settop(L,3);
- lua_rawseti(L,1,n);
+ lua_get_metatablelua(node_properties);
+ lua_insert(L, -2);
+ lua_rawseti(L, -2, n);
}
return 0;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdfelib.c b/Build/source/texk/web2c/luatexdir/lua/lpdfelib.c
index 5b1093a28a5..030e3db7e6c 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdfelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdfelib.c
@@ -45,7 +45,7 @@
# undef output
# endif
-# include "luapplib/src/pplib.h"
+# include "pplib.h"
# include "image/epdf.h"
@@ -1237,9 +1237,10 @@ static int pdfelib_getfromreference(lua_State * L)
ppref *r = (((pdfe_reference *) p)->xref != NULL) ? ppxref_find(((pdfe_reference *) p)->xref, (ppuint) (((pdfe_reference *) p)->onum)) : NULL; \
ppobj *o = (r != NULL) ? ppref_obj(r) : NULL; \
-# define pdfelib_get_value_direct(get_d,get_a) do { \
+# define pdfelib_get_value_direct(get_d,get_a) do { \
int t = lua_type(L,2); \
void *p = lua_touserdata(L, 1); \
+ lua_settop(L,2); \
pdfelib_get_value_check_1; \
if (t == LUA_TSTRING) { \
const char *key = lua_tostring(L,-2); \
@@ -1286,6 +1287,7 @@ static int pdfelib_getfromreference(lua_State * L)
# define pdfelib_get_value_indirect(get_d,get_a) do { \
int t = lua_type(L,2); \
void *p = lua_touserdata(L, 1); \
+ lua_settop(L,2); \
pdfelib_get_value_check_1; \
if (t == LUA_TSTRING) { \
const char *key = lua_tostring(L,-2); \
@@ -1320,6 +1322,8 @@ static int pdfelib_getfromreference(lua_State * L)
} \
} while (0)
+/* pre 1.13 version:
+
static int pdfelib_getstring(lua_State * L)
{
if (lua_gettop(L) > 1) {
@@ -1327,7 +1331,38 @@ static int pdfelib_getstring(lua_State * L)
pdfelib_get_value_direct(ppdict_rget_string,pparray_rget_string);
if (value != NULL) {
lua_pushlstring(L, ppstring_data(value), ppstring_size(value));
- return 1;
+ return 2;
+ }
+ }
+ return 0;
+}
+
+*/
+
+static int pdfelib_getstring(lua_State *L)
+{
+ if (lua_gettop(L) > 1) {
+ ppstring *value = NULL;
+ int how = 0;
+ if (lua_type(L, 3) == LUA_TBOOLEAN) {
+ if (lua_toboolean(L, 3)) {
+ how = 1;
+ } else {
+ how = 2;
+ }
+ }
+ pdfelib_get_value_direct(ppdict_rget_string,pparray_rget_string);
+ if (value != NULL) {
+ if (how == 1) {
+ value = ppstring_decoded(value);
+ }
+ lua_pushlstring(L,ppstring_data(value),ppstring_size(value));
+ if (how == 2) {
+ lua_pushboolean(L,ppstring_hex(value));
+ return 2;
+ } else {
+ return 1;
+ }
}
}
return 0;
diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.c b/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.c
index 4fc62a2ccf9..90e7da58bf0 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.c
@@ -78,7 +78,7 @@
#include <lauxlib.h>
#include <lualib.h>
-#include "luapplib/src/pplib.h"
+#include "pplib.h"
#include <lua/luatex-api.h>