diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-12-10 09:22:25 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-12-10 09:22:25 +0000 |
commit | 70b9e104222eb5ba7a495c6267643c6470fb4667 (patch) | |
tree | 6b540c75177a4ec7d7ad0b607542c0f3620b1d3e /Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c | |
parent | db2683e88ae12a32ad6620b4e40218761ea14f41 (diff) |
LuaTeX: Sync with https://foundry.supelec.fr/svn/luatex/trunk r5092
git-svn-id: svn://tug.org/texlive/trunk@35779 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c index 160fbe3bde6..f8b4360e56b 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c @@ -21,7 +21,7 @@ #include "lua/luatex-api.h" static const char _svn_version[] = - "$Id: lcallbacklib.c 4956 2014-03-28 12:12:17Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lcallbacklib.c $"; + "$Id: lcallbacklib.c 5081 2014-11-07 18:38:33Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lcallbacklib.c $"; int callback_count = 0; int saved_callback_count = 0; @@ -69,6 +69,7 @@ static const char *const callbacknames[] = { "finish_pdfpage", "pre_dump","start_file", "stop_file", "show_error_message","show_lua_error_hook", + "pdf_stream_filter_callback", NULL }; @@ -188,6 +189,7 @@ void get_saved_lua_string(int r, const char *name, char **target) #define CALLBACK_STRNUMBER 's' #define CALLBACK_STRING 'S' #define CALLBACK_CHARNUM 'c' +#define CALLBACK_LSTRING 'L' int run_saved_callback(int r, const char *name, const char *values, ...) @@ -265,6 +267,7 @@ int do_run_callback(int special, const char *values, va_list vl) size_t len; int narg, nres; const char *s; + lstring *lstr; char cs; int *bufloc; char *ss = NULL; @@ -288,6 +291,10 @@ int do_run_callback(int special, const char *values, va_list vl) s = va_arg(vl, char *); lua_pushstring(L, s); break; + case CALLBACK_LSTRING: /* 'lstring' */ + lstr = va_arg(vl, lstring *); + lua_pushlstring(L, (const char *)lstr->s, lstr->l); + break; case CALLBACK_INTEGER: /* int */ lua_pushnumber(L, va_arg(vl, int)); break; @@ -420,6 +427,26 @@ int do_run_callback(int special, const char *values, va_list vl) *va_arg(vl, char **) = ss; } break; + case CALLBACK_LSTRING: /* lstring */ + if (!lua_isstring(L, nres)) { + if (!lua_isnil(L, nres)) { + fprintf(stderr, "Expected a string for (S), not: %s\n", + lua_typename(L, lua_type(L, nres))); + goto EXIT; + } + } + s = lua_tolstring(L, nres, &len); + + if (s == NULL) /* |len| can be zero */ + *va_arg(vl, int *) = 0; + else { + lstring *ret = xmalloc(sizeof(lstring)); + ret->s = xmalloc((unsigned) (len + 1)); + (void) memcpy(ret->s, s, (len + 1)); + ret->l = len; + *va_arg(vl, lstring **) = ret; + } + break; default: fprintf(stdout, "invalid return value type"); goto EXIT; |