summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-11-14 00:48:08 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-11-14 00:48:08 +0000
commit64322869cd45fa0029198b6ef544363a0cf49eb6 (patch)
treefaa34b755a1bd7b9b5ca4a66d204deebf841d119 /Build/source/texk/web2c/luatexdir/lua/lstatslib.c
parent6d37525a79984eea934633c34944113831e3fecb (diff)
web2c/luatexdir: Sync with the upstream trunk.
git-svn-id: svn://tug.org/texlive/trunk@38844 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua/lstatslib.c')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lstatslib.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
index eeb447f5064..74781cbd6af 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
@@ -31,8 +31,6 @@ typedef const char *(*charfunc) (void);
typedef lua_Number(*numfunc) (void);
typedef int (*intfunc) (void);
-const char *last_lua_error;
-
static const char *getbanner(void)
{
return (const char *) luatex_banner;
@@ -43,7 +41,6 @@ static const char *getlogname(void)
return (const char *) texmf_log_name;
}
-
static const char *get_output_file_name(void)
{
if (static_pdf != NULL)
@@ -73,7 +70,20 @@ static const char *getlastluaerror(void)
return last_lua_error;
}
+static const char *getlastwarningtag(void)
+{
+ return last_warning_tag;
+}
+static const char *getlastwarningstr(void)
+{
+ return last_warning_str;
+}
+
+static const char *getlasterrorcontext(void)
+{
+ return last_error_context;
+}
static const char *luatexrevision(void)
{
@@ -189,6 +199,9 @@ static struct statistic stats[] = {
{"lasterrorstring", 'S', (void *) &getlasterror},
{"lastluaerrorstring", 'S', (void *) &getlastluaerror},
+ {"lastwarningtag", 'S', (void *) &getlastwarningtag},
+ {"lastwarningstring", 'S', (void *) &getlastwarningstr},
+ {"lasterrorcontext", 'S', (void *) &getlasterrorcontext},
/* seldom or never accessed */
@@ -240,6 +253,7 @@ static struct statistic stats[] = {
{"param_size", 'g', &param_size},
{"buf_size", 'g', &buf_size},
{"save_size", 'g', &save_size},
+ {"input_ptr", 'g', &input_ptr},
/* pdf stats */
{"obj_ptr", 'N', &get_obj_ptr},
{"obj_tab_size", 'N', &get_obj_tab_size},
@@ -331,7 +345,7 @@ static int getstats(lua_State * L)
{
const char *st;
int i;
- if (lua_isstring(L, -1)) {
+ if (lua_type(L,-1) == LUA_TSTRING) {
st = lua_tostring(L, -1);
i = stats_name_to_id(st);
if (i >= 0) {
@@ -361,10 +375,22 @@ static int statslist(lua_State * L)
return 1;
}
-
+static int resetmessages(lua_State * L)
+{
+ xfree(last_warning_str);
+ xfree(last_warning_tag);
+ xfree(last_error);
+ xfree(last_lua_error);
+ last_warning_str = NULL;
+ last_warning_tag = NULL;
+ last_error = NULL;
+ last_lua_error = NULL;
+ return 0;
+}
static const struct luaL_Reg statslib[] = {
{"list", statslist},
+ {"resetmessages", resetmessages},
{NULL, NULL} /* sentinel */
};