summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lua
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2018-01-09 23:43:20 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2018-01-09 23:43:20 +0000
commitaa5d0e8bf3515c424ba0594a2d4e06ae31da7796 (patch)
treee56fd10d89732547ddb207c1998a1ded4360382e /Build/source/texk/web2c/luatexdir/lua
parentd33684eeca435784c95c62c7981dd02f7818b263 (diff)
Imported Luatex 1.06.3 (Lua 5.2.4)
git-svn-id: svn://tug.org/texlive/trunk@46269 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h1
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lepdflib.cc348
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lfontlib.c72
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/liolibext.c274
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/llualib.c11
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c600
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdflib.c21
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lstatslib.c13
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lstrlibext.c130
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexlib.c223
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luainit.w70
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luanode.w13
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luastuff.w28
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h10
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-core.c460
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-core.lua442
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatoken.w1
19 files changed, 1970 insertions, 752 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h b/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h
index d71a6786845..802ed6f6394 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h
+++ b/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h
@@ -36,6 +36,5 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op);
#endif
#define luaL_newlibtable(L,l) lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
-#define luaL_newlib(L,l) (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
#endif
diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
index 7944fdfd8a5..adb1ffd52e2 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
@@ -54,7 +54,7 @@ static const char *const callbacknames[] = {
"pre_output_filter",
"buildpage_filter",
"hpack_filter", "vpack_filter",
- "char_exists",
+ "glyph_not_found",
"hyphenate",
"ligaturing",
"kerning",
@@ -75,6 +75,7 @@ static const char *const callbacknames[] = {
"call_edit",
"build_page_insert",
"glyph_stream_provider",
+ "finish_synctex_callback",
NULL
};
diff --git a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc
index 7250ffd1863..cac1bd024b0 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -21,7 +21,9 @@
#include "image/epdf.h"
-
+// Patches for the new poppler 0.59 from
+// https://www.mail-archive.com/arch-commits@archlinux.org/msg357548.html
+// with some modifications to comply the poppler API.
// define DEBUG
@@ -253,6 +255,12 @@ static int l_new_Attribute(lua_State * L)
lua_settable(L,-3)
+#define OBJECT_TYPE(name) \
+ lua_pushstring(L, #name); \
+ lua_pushinteger(L, (int)name); \
+ lua_settable(L,-3)
+
+
#define STRUCTELEMENT_TYPE_ENTRY(name) \
lua_pushstring(L, #name); \
lua_pushinteger(L, StructElement::name); \
@@ -306,6 +314,28 @@ static int l_Attribute_Type(lua_State * L) {
return 1;
}
+static int l_Object_Type(lua_State * L) {
+ lua_createtable(L,0,16);/*nr of ObjType values*/ ;
+ OBJECT_TYPE(objBool);
+ OBJECT_TYPE(objInt);
+ OBJECT_TYPE(objReal);
+ OBJECT_TYPE(objString);
+ OBJECT_TYPE(objName);
+ OBJECT_TYPE(objNull);
+ OBJECT_TYPE(objArray);
+ OBJECT_TYPE(objDict);
+ OBJECT_TYPE(objStream);
+ OBJECT_TYPE(objRef);
+ OBJECT_TYPE(objCmd);
+ OBJECT_TYPE(objError);
+ OBJECT_TYPE(objEOF);
+ OBJECT_TYPE(objNone);
+ OBJECT_TYPE(objInt64);
+ OBJECT_TYPE(objDead);
+ return 1;
+}
+
+
static int l_StructElement_Type(lua_State * L) {
lua_createtable (L, 0, 50);
STRUCTELEMENT_TYPE_ENTRY(Document);
@@ -398,14 +428,136 @@ static int l_new_Dict(lua_State * L)
static int l_new_Object(lua_State * L)
{
udstruct *uout;
+ int n = lua_gettop(L); // number of arguments
uout = new_Object_userdata(L);
- uout->d = new Object(); // automatic init to type "none"
- uout->atype = ALLOC_LEPDF;
- uout->pc = 0;
- uout->pd = NULL; // not connected to any PDFDoc
+ switch(n) {
+ case 0:
+ uout->d = new Object(); // automatic init to type "none"
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL; // not connected to any PDFDoc
+ break;
+ case 1:
+ if (lua_isboolean (L,1)) {
+ uout->d = new Object(lua_toboolean(L, 1)? gTrue : gFalse);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+ } else if (lua_isnumber (L,1)) {
+ double d = lua_tonumber(L,1);
+ // Missed :Object(long long int64gA)
+ if (d==((int)d)) {
+ uout->d = new Object((int)d);
+ } else {
+ uout->d = new Object(d);
+ }
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+ } else if (lua_isstring (L,1)){
+ GooString *gs;
+ const char *s;
+ size_t len;
+ s = luaL_checklstring(L, 2, &len);
+ gs = new GooString(s, len);
+ uout->d = new Object(gs);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+ } else if (luaL_testudata(L,1,M_Array)){
+ udstruct *u;
+ Array *a;
+ u = (udstruct *) luaL_checkudata(L, 1, M_Array);
+ a = (Array *)u->d;
+ uout->d = new Object(a);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+ } else if (luaL_testudata(L,1,M_Dict)){
+ udstruct *u;
+ Dict *d;
+ u = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ d = (Dict *)u->d;
+ uout->d = new Object(d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+ } else if (luaL_testudata(L,1,M_Stream)){
+ udstruct *u;
+ Stream *s;
+ u = (udstruct *) luaL_checkudata(L, 1, M_Stream);
+ s = (Stream *)u->d;
+ *((Object *) uout->d) = Object(s);
+ } else
+ luaL_error(L, "Invalid/unsupported value for Object constructor");
+ break;
+ case 2:
+ if (lua_isnumber (L,1) && lua_isnumber (L,2)) {
+ double numA = lua_tonumber(L,1);
+ double genA = lua_tonumber(L,2);
+ if ( ((numA)==(int)(numA)) && ((genA)==(int)(genA)) ){
+ uout->d = new Object((int)(numA), (int)(genA));
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+ }
+ } else if (lua_isnumber (L,1) && (lua_isstring(L,2)|| lua_isnoneornil(L,2))) {
+ double d_typeA = lua_tonumber(L,1);
+ int typeA = (int)(d_typeA);
+ if (d_typeA==typeA){
+ switch((int)(typeA)) {
+ case objBool:
+ case objInt:
+ case objReal:
+ case objString:
+ case objName:
+ case objNull:
+ case objArray:
+ case objDict:
+ case objStream:
+ case objRef:
+ case objCmd:
+ case objError:
+ case objEOF:
+ case objNone:
+ case objInt64:
+ case objDead:
+ if (lua_isstring(L,2))
+ uout->d = new Object((ObjType)(typeA), luaL_checkstring(L, 2));
+ else
+ uout->d = new Object((ObjType)(typeA));
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+
+ break;
+ default:
+ luaL_error(L, "Invalid values for Object constructor");
+ break;
+ }//switch((int)(d))
+ } else // (d_typeA)!=(typeA)
+ luaL_error(L, "Invalid/unsupported values for Object constructor");
+ } // if (lua_isnumber (L,1) && (lua_isstring(L,2)|| lua_isnoneornil(L,2)))
+ break;
+ default:
+ luaL_error(L, "Invalid specification for Object constructor");
+ }
+ lua_settop(L,1);
return 1;
}
+// static int l_new_Object(lua_State * L)
+// {
+// udstruct *uout;
+// uout = new_Object_userdata(L);
+// uout->d = new Object(); // automatic init to type "none"
+// uout->atype = ALLOC_LEPDF;
+// uout->pc = 0;
+// uout->pd = NULL; // not connected to any PDFDoc
+// return 1;
+// }
+
+
// PDFRectangle see Page.h
static int l_new_PDFRectangle(lua_State * L)
@@ -429,6 +581,7 @@ static const struct luaL_Reg epdflib_f[] = {
{"AttributeOwner_Type",l_AttributeOwner_Type},
{"Dict", l_new_Dict},
{"Object", l_new_Object},
+ {"Object_Type", l_Object_Type},
{"PDFRectangle", l_new_PDFRectangle},
{NULL, NULL} // sentinel
};
@@ -538,7 +691,7 @@ static int m_##in##_##function(lua_State * L) \
pdfdoc_changed_error(L); \
uout = new_Object_userdata(L); \
uout->d = new Object(); \
- ((in *) uin->d)->function((Object *) uout->d); \
+ *((Object *)uout->d) = ((in *) uin->d)->function(); \
uout->atype = ALLOC_LEPDF; \
uout->pc = uin->pc; \
uout->pd = uin->pd; \
@@ -665,30 +818,27 @@ static const struct luaL_Reg Annots_m[] = {
//**********************************************************************
// Array
-
-static int m_Array_incRef(lua_State * L)
-{
- int i;
- udstruct *uin;
- uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- i = ((Array *) uin->d)->incRef();
- lua_pushinteger(L, i);
- return 1;
-}
-
-static int m_Array_decRef(lua_State * L)
-{
- int i;
- udstruct *uin;
- uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- i = ((Array *) uin->d)->decRef();
- lua_pushinteger(L, i);
- return 1;
-}
+// Now private
+// static int m_Array_incRef(lua_State * L)
+// {
+// udstruct *uin;
+// uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+// if (uin->pd != NULL && uin->pd->pc != uin->pc)
+// pdfdoc_changed_error(L);
+// lua_pushinteger(L, 1);
+// return 1;
+// }
+// Now private
+// static int m_Array_decRef(lua_State * L)
+// {
+// int i;
+// udstruct *uin;
+// uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+// if (uin->pd != NULL && uin->pd->pc != uin->pc)
+// pdfdoc_changed_error(L);
+// lua_pushinteger(L, 1);
+// return 1;
+// }
m_poppler_get_INT(Array, getLength);
@@ -702,7 +852,7 @@ static int m_Array_add(lua_State * L)
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
|| (uobj->pd != NULL && uobj->pd->pc != uobj->pc))
pdfdoc_changed_error(L);
- ((Array *) uin->d)->add(((Object *) uobj->d));
+ ((Array *) uin->d)->add(std::move(*((Object *) uobj->d)));
return 0;
}
@@ -718,7 +868,7 @@ static int m_Array_get(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Array *) uin->d)->get(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Array *) uin->d)->get(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -739,7 +889,7 @@ static int m_Array_getNF(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Array *) uin->d)->getNF(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -773,8 +923,8 @@ static int m_Array_getString(lua_State * L)
m_poppler__tostring(Array);
static const struct luaL_Reg Array_m[] = {
- {"incRef", m_Array_incRef},
- {"decRef", m_Array_decRef},
+ // {"incRef", m_Array_incRef},// Now private
+ // {"decRef", m_Array_decRef},// Now private
{"getLength", m_Array_getLength},
{"add", m_Array_add},
{"get", m_Array_get},
@@ -950,30 +1100,26 @@ static const struct luaL_Reg Catalog_m[] = {
//**********************************************************************
// Dict
-
-static int m_Dict_incRef(lua_State * L)
-{
- int i;
- udstruct *uin;
- uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- i = ((Dict *) uin->d)->incRef();
- lua_pushinteger(L, i);
- return 1;
-}
-
-static int m_Dict_decRef(lua_State * L)
-{
- int i;
- udstruct *uin;
- uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- i = ((Dict *) uin->d)->decRef();
- lua_pushinteger(L, i);
- return 1;
-}
+// Now private
+// static int m_Dict_incRef(lua_State * L)
+// {
+// udstruct *uin;
+// uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+// if (uin->pd != NULL && uin->pd->pc != uin->pc)
+// pdfdoc_changed_error(L);
+// lua_pushinteger(L, 1);
+// return 1;
+// }
+// Now private
+// static int m_Dict_decRef(lua_State * L)
+// {
+// udstruct *uin;
+// uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+// if (uin->pd != NULL && uin->pd->pc != uin->pc)
+// pdfdoc_changed_error(L);
+// lua_pushinteger(L, 1);
+// return 1;
+// }
m_poppler_get_INT(Dict, getLength);
@@ -986,7 +1132,7 @@ static int m_Dict_add(lua_State * L)
pdfdoc_changed_error(L);
s = copyString(luaL_checkstring(L, 2));
uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
- ((Dict *) uin->d)->add(s, ((Object *) uobj->d));
+ ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d)));
return 0;
}
@@ -999,7 +1145,7 @@ static int m_Dict_set(lua_State * L)
pdfdoc_changed_error(L);
s = luaL_checkstring(L, 2);
uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
- ((Dict *) uin->d)->set(s, ((Object *) uobj->d));
+ ((Dict *) uin->d)->set(s, std::move(*((Object *) uobj->d)));
return 0;
}
@@ -1027,7 +1173,7 @@ static int m_Dict_lookup(lua_State * L)
s = luaL_checkstring(L, 2);
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Dict *) uin->d)->lookup(s, (Object *) uout->d);
+ *((Object *) uout->d) = ((Dict *) uin->d)->lookup(s);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1044,7 +1190,7 @@ static int m_Dict_lookupNF(lua_State * L)
s = luaL_checkstring(L, 2);
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Dict *) uin->d)->lookupNF(s, (Object *) uout->d);
+ *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1096,7 +1242,7 @@ static int m_Dict_getVal(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Dict *) uin->d)->getVal(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Dict *) uin->d)->getVal(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1117,7 +1263,7 @@ static int m_Dict_getValNF(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Dict *) uin->d)->getValNF(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1131,8 +1277,8 @@ m_poppler_check_string(Dict, hasKey);
m_poppler__tostring(Dict);
static const struct luaL_Reg Dict_m[] = {
- {"incRef", m_Dict_incRef},
- {"decRef", m_Dict_decRef},
+ // {"incRef", m_Dict_incRef},// Now private
+ // {"decRef", m_Dict_decRef},// Now private
{"getLength", m_Dict_getLength},
{"add", m_Dict_add},
{"set", m_Dict_set},
@@ -1381,9 +1527,9 @@ static int m_Object_initBool(lua_State * L)
pdfdoc_changed_error(L);
luaL_checktype(L, 2, LUA_TBOOLEAN);
if (lua_toboolean(L, 2) != 0)
- ((Object *) uin->d)->initBool(gTrue);
+ *((Object *) uin->d) = Object(gTrue);
else
- ((Object *) uin->d)->initBool(gFalse);
+ *((Object *) uin->d) = Object(gFalse);
return 0;
}
@@ -1395,7 +1541,7 @@ static int m_Object_initInt(lua_State * L)
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
i = luaL_checkint(L, 2);
- ((Object *) uin->d)->initInt(i);
+ *((Object *) uin->d) = Object(i);
return 0;
}
@@ -1407,7 +1553,7 @@ static int m_Object_initReal(lua_State * L)
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
d = luaL_checknumber(L, 2);
- ((Object *) uin->d)->initReal(d);
+ *((Object *) uin->d) = Object(d);
return 0;
}
@@ -1422,7 +1568,7 @@ static int m_Object_initString(lua_State * L)
pdfdoc_changed_error(L);
s = luaL_checklstring(L, 2, &len);
gs = new GooString(s, len);
- ((Object *) uin->d)->initString(gs);
+ *((Object *) uin->d) = Object(gs);
return 0;
}
@@ -1434,7 +1580,7 @@ static int m_Object_initName(lua_State * L)
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
s = luaL_checkstring(L, 2);
- ((Object *) uin->d)->initName(s);
+ *((Object *) uin->d) = Object(objName, s);
return 0;
}
@@ -1444,13 +1590,14 @@ static int m_Object_initNull(lua_State * L)
uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- ((Object *) uin->d)->initNull();
+ *((Object *) uin->d) = Object(objNull);
return 0;
}
static int m_Object_initArray(lua_State * L)
{
udstruct *uin, *uxref;
+ Array *a;
uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
uxref = (udstruct *) luaL_checkudata(L, 2, M_XRef);
if (uin->pd != NULL && uxref->pd != NULL && uin->pd != uxref->pd)
@@ -1458,7 +1605,8 @@ static int m_Object_initArray(lua_State * L)
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
|| (uxref->pd != NULL && uxref->pd->pc != uxref->pc))
pdfdoc_changed_error(L);
- ((Object *) uin->d)->initArray((XRef *) uxref->d);
+ a = new Array((XRef *) uxref->d);
+ *((Object *) uin->d) = Object(a);
return 0;
}
@@ -1469,6 +1617,7 @@ static int m_Object_initArray(lua_State * L)
static int m_Object_initDict(lua_State * L)
{
udstruct *uin, *uxref;
+ Dict *d;
uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
uxref = (udstruct *) luaL_checkudata(L, 2, M_XRef);
if (uin->pd != NULL && uxref->pd != NULL && uin->pd != uxref->pd)
@@ -1476,7 +1625,8 @@ static int m_Object_initDict(lua_State * L)
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
|| (uxref->pd != NULL && uxref->pd->pc != uxref->pc))
pdfdoc_changed_error(L);
- ((Object *) uin->d)->initDict((XRef *) uxref->d);
+ d = new Dict((XRef *) uxref->d);
+ *((Object *) uin->d) = Object(d);
return 0;
}
@@ -1490,7 +1640,7 @@ static int m_Object_initStream(lua_State * L)
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
|| (ustream->pd != NULL && ustream->pd->pc != ustream->pc))
pdfdoc_changed_error(L);
- ((Object *) uin->d)->initStream((Stream *) ustream->d);
+ *((Object *) uin->d) = Object((Stream *) ustream->d);
return 0;
}
@@ -1503,7 +1653,7 @@ static int m_Object_initRef(lua_State * L)
pdfdoc_changed_error(L);
num = luaL_checkint(L, 2);
gen = luaL_checkint(L, 3);
- ((Object *) uin->d)->initRef(num, gen);
+ *((Object *) uin->d) = Object(num, gen);
return 0;
}
@@ -1515,7 +1665,7 @@ static int m_Object_initCmd(lua_State * L)
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
s = luaL_checkstring(L, 2);
- ((Object *) uin->d)->initCmd(CHARP_CAST s);
+ *((Object *) uin->d) = Object(objCmd, CHARP_CAST s);
return 0;
}
@@ -1525,7 +1675,7 @@ static int m_Object_initError(lua_State * L)
uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- ((Object *) uin->d)->initError();
+ *((Object *) uin->d) = Object(objError);
return 0;
}
@@ -1535,7 +1685,7 @@ static int m_Object_initEOF(lua_State * L)
uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
- ((Object *) uin->d)->initEOF();
+ *((Object *) uin->d) = Object(objEOF);
return 0;
}
@@ -1551,7 +1701,7 @@ static int m_Object_fetch(lua_State * L)
pdfdoc_changed_error(L);
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Object *) uin->d)->fetch((XRef *) uxref->d, (Object *) uout->d);
+ *((Object *) uout->d) = ((Object *) uin->d)->fetch((XRef *) uxref->d);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1816,7 +1966,7 @@ static int m_Object_arrayAdd(lua_State * L)
pdfdoc_changed_error(L);
if (!((Object *) uin->d)->isArray())
luaL_error(L, "Object is not an Array");
- ((Object *) uin->d)->arrayAdd((Object *) uobj->d);
+ ((Object *) uin->d)->arrayAdd(std::move(*((Object *) uobj->d)));
return 0;
}
@@ -1833,7 +1983,7 @@ static int m_Object_arrayGet(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Object *) uin->d)->arrayGet(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Object *) uin->d)->arrayGet(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1857,7 +2007,7 @@ static int m_Object_arrayGetNF(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Object *) uin->d)->arrayGetNF(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1897,7 +2047,7 @@ static int m_Object_dictAdd(lua_State * L)
pdfdoc_changed_error(L);
if (!((Object *) uin->d)->isDict())
luaL_error(L, "Object is not a Dict");
- ((Object *) uin->d)->dictAdd(copyString(s), (Object *) uobj->d);
+ ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d)));
return 0;
}
@@ -1915,7 +2065,7 @@ static int m_Object_dictSet(lua_State * L)
pdfdoc_changed_error(L);
if (!((Object *) uin->d)->isDict())
luaL_error(L, "Object is not a Dict");
- ((Object *) uin->d)->dictSet(s, (Object *) uobj->d);
+ ((Object *) uin->d)->dictSet(s, std::move(*((Object *) uobj->d)));
return 0;
}
@@ -1930,7 +2080,7 @@ static int m_Object_dictLookup(lua_State * L)
if (((Object *) uin->d)->isDict()) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Object *) uin->d)->dictLookup(s, (Object *) uout->d);
+ *((Object *) uout->d) = ((Object *) uin->d)->dictLookup(s);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1950,7 +2100,7 @@ static int m_Object_dictLookupNF(lua_State * L)
if (((Object *) uin->d)->isDict()) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Object *) uin->d)->dictLookupNF(s, (Object *) uout->d);
+ *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -1991,7 +2141,7 @@ static int m_Object_dictGetVal(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Object *) uin->d)->dictGetVal(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Object *) uin->d)->dictGetVal(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -2015,7 +2165,7 @@ static int m_Object_dictGetValNF(lua_State * L)
if (i > 0 && i <= len) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((Object *) uin->d)->dictGetValNF(i - 1, (Object *) uout->d);
+ *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -2243,7 +2393,7 @@ m_poppler_get_poppler(Page, Stream, getMetadata);
m_poppler_get_poppler(Page, Dict, getPieceInfo);
m_poppler_get_poppler(Page, Dict, getSeparationInfo);
m_poppler_get_poppler(Page, Dict, getResourceDict);
-m_poppler_get_OBJECT(Page, getAnnots);
+m_poppler_get_OBJECT(Page, getAnnotsObject);
m_poppler_get_OBJECT(Page, getContents);
@@ -2270,7 +2420,7 @@ static const struct luaL_Reg Page_m[] = {
{"getPieceInfo", m_Page_getPieceInfo},
{"getSeparationInfo", m_Page_getSeparationInfo},
{"getResourceDict", m_Page_getResourceDict},
- {"getAnnots", m_Page_getAnnots},
+ {"getAnnotsObject", m_Page_getAnnotsObject},
{"getContents", m_Page_getContents},
{"__tostring", m_Page__tostring},
{NULL, NULL} // sentinel
@@ -2520,7 +2670,7 @@ static int m_PDFDoc_getDocInfo(lua_State * L)
if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((PdfDocument *) uin->d)->doc->getDocInfo((Object *) uout->d);
+ *((Object *) uout->d) = ((PdfDocument *) uin->d)->doc->getDocInfo();
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -2538,7 +2688,7 @@ static int m_PDFDoc_getDocInfoNF(lua_State * L)
if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) {
uout = new_Object_userdata(L);
uout->d = new Object();
- ((PdfDocument *) uin->d)->doc->getDocInfoNF((Object *) uout->d);
+ *((Object *) uout->d) = ((PdfDocument *) uin->d)->doc->getDocInfoNF();
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -2841,7 +2991,7 @@ static int m_Attribute_getValue(lua_State * L)
uout = new_Object_userdata(L);
uout->d = new Object();
origin = (Object *) (((Attribute *) uin->d)->getValue());
- origin->copy ( ((Object *)uout->d) );
+ *((Object *) uout->d) = origin->copy();
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -3320,7 +3470,8 @@ static int m_StructTreeRoot_findParentElement(lua_State * L)
parent = root->findParentElement(i-1);
if (parent != NULL) {
uout = new_StructElement_userdata(L);
- uout->d = new StructElement( *parent );
+ // see https://isocpp.org/wiki/faq/const-correctness#aliasing-and-const
+ uout->d = (StructElement *) parent;
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
@@ -3331,7 +3482,6 @@ static int m_StructTreeRoot_findParentElement(lua_State * L)
static const struct luaL_Reg StructTreeRoot_m[] = {
- {"findParentElement", m_StructTreeRoot_findParentElement},
{"getDoc",m_StructTreeRoot_getDoc},
{"getRoleMap",m_StructTreeRoot_getRoleMap},
{"getClassMap",m_StructTreeRoot_getClassMap},
@@ -3370,7 +3520,7 @@ static int m_XRef_fetch(lua_State * L)
gen = luaL_checkint(L, 3);
uout = new_Object_userdata(L);
uout->d = new Object();
- ((XRef *) uin->d)->fetch(num, gen, (Object *) uout->d);
+ *((Object *) uout->d) = ((XRef *) uin->d)->fetch(num, gen);
uout->atype = ALLOC_LEPDF;
uout->pc = uin->pc;
uout->pd = uin->pd;
diff --git a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
index 7e35d2360b7..0304be8bd11 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
@@ -155,15 +155,15 @@ static int frozenfont(lua_State * L)
static int setfont(lua_State * L)
{
- int i = luaL_checkinteger(L, -2);
+ int t = lua_gettop(L);
+ int i = luaL_checkinteger(L,1);
if (i) {
- luaL_checktype(L, -1, LUA_TTABLE);
+ luaL_checktype(L, t, LUA_TTABLE);
if (is_valid_font(i)) {
- if (!(font_touched(i) || font_used(i))) {
+ if (! (font_touched(i) || font_used(i))) {
font_from_lua(L, i);
} else {
- luaL_error(L,
- "that font has been accessed already, changing it is forbidden");
+ luaL_error(L, "that font has been accessed already, changing it is forbidden");
}
} else {
luaL_error(L, "that integer id is not a valid font");
@@ -172,10 +172,56 @@ static int setfont(lua_State * L)
return 0;
}
+static int addcharacters(lua_State * L)
+{
+ int t = lua_gettop(L);
+ int i = luaL_checkinteger(L,1);
+ if (i) {
+ luaL_checktype(L, t, LUA_TTABLE);
+ if (is_valid_font(i)) {
+ characters_from_lua(L, i);
+ } else {
+ luaL_error(L, "that integer id is not a valid font");
+ }
+ }
+ return 0;
+}
+
+static int setexpansion(lua_State * L)
+{
+ int f = luaL_checkinteger(L,1);
+ if (f) {
+ if (is_valid_font(f)) {
+ int fstretch = luaL_checkinteger(L,2);
+ int fshrink = luaL_checkinteger(L,3);
+ int fstep = luaL_checkinteger(L,4);
+ set_expand_params(f, fstretch, fshrink, fstep);
+ } else {
+ luaL_error(L, "that integer id is not a valid font");
+ }
+ }
+ return 0;
+}
+
+/* font.define(id,table) */
+/* font.define(table) */
static int deffont(lua_State * L)
{
- int i = get_fontid();
+ int i = 0;
+ int t = lua_gettop(L);
+ if (t == 2) {
+ i = lua_tointeger(L,1);
+ if ((i <= 0) || ! is_valid_font(i)) {
+ lua_pop(L, 1); /* pop the broken table */
+ luaL_error(L, "font creation failed, invalid id passed");
+ }
+ } else if (t == 1) {
+ i = get_fontid();
+ } else {
+ luaL_error(L, "font creation failed, no table passed");
+ return 0;
+ }
luaL_checktype(L, -1, LUA_TTABLE);
if (font_from_lua(L, i)) {
lua_pushinteger(L, i);
@@ -183,21 +229,25 @@ static int deffont(lua_State * L)
} else {
lua_pop(L, 1); /* pop the broken table */
delete_font(i);
- luaL_error(L, "font creation failed");
+ luaL_error(L, "font creation failed, error in table");
}
return 0; /* not reached */
}
/* this returns the expected (!) next fontid. */
+/* first arg true will keep the id */
+
static int nextfontid(lua_State * L)
{
+ int b = ((lua_gettop(L) == 1) && lua_toboolean(L,1));
int i = get_fontid();
lua_pushinteger(L, i);
- delete_font(i);
+ if (b == 0) {
+ delete_font(i);
+ }
return 1;
}
-
static int getfont(lua_State * L)
{
int i = luaL_checkinteger(L, -1);
@@ -207,7 +257,6 @@ static int getfont(lua_State * L)
return 1;
}
-
static int getfontid(lua_State * L)
{
if (lua_type(L, 1) == LUA_TSTRING) {
@@ -228,7 +277,6 @@ static int getfontid(lua_State * L)
return 1;
}
-
static const struct luaL_Reg fontlib[] = {
{"read_tfm", font_read_tfm},
{"read_vf", font_read_vf},
@@ -237,6 +285,8 @@ static const struct luaL_Reg fontlib[] = {
{"each", tex_each_font},
{"getfont", getfont},
{"setfont", setfont},
+ {"addcharacters", addcharacters},
+ {"setexpansion", setexpansion},
{"define", deffont},
{"nextid", nextfontid},
{"id", getfontid},
diff --git a/Build/source/texk/web2c/luatexdir/lua/liolibext.c b/Build/source/texk/web2c/luatexdir/lua/liolibext.c
index 958cbb67b43..7bd6fa4519b 100644
--- a/Build/source/texk/web2c/luatexdir/lua/liolibext.c
+++ b/Build/source/texk/web2c/luatexdir/lua/liolibext.c
@@ -29,11 +29,9 @@
#endif
#include "lualib.h"
-
-
#ifdef LuajitTeX
/* luajit has its own way for io, which is a mix of */
-/* lua 5.1 and lua 5.2 . We use the stock luajit. */
+/* lua 5.1 and lua 5.2 . We use the stock luajit. */
#else
/*
** {======================================================
@@ -61,7 +59,6 @@
/* }====================================================== */
-
#if defined(LUA_USE_POSIX)
#define l_fseek(f,o,w) fseeko(f,o,w)
@@ -92,9 +89,6 @@
#endif/* #ifdef LuajitTeX */
-
-
-
static FILE *tofile (lua_State *L) {
#ifdef LuajitTeX
FILE **f = luaL_checkudata(L,1,LUA_FILEHANDLE);
@@ -110,6 +104,8 @@ static FILE *tofile (lua_State *L) {
#endif
}
+#define uchar(c) ((unsigned char)(c))
+
/*
HH: A few helpers to avoid reading numbers as strings. For now we put them in their
own namespace. We also have a few helpers that can make io functions tex friendly.
@@ -125,6 +121,19 @@ static int readcardinal1(lua_State *L) {
return 1;
}
+static int readcardinal1_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p]);
+ lua_pushinteger(L, a);
+ }
+ return 1;
+}
+
static int readcardinal2(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -137,6 +146,20 @@ static int readcardinal2(lua_State *L) {
return 1;
}
+static int readcardinal2_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+1 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p]);
+ lua_pushinteger(L, 0x100 * a + b);
+ }
+ return 1;
+}
+
static int readcardinal3(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -150,6 +173,21 @@ static int readcardinal3(lua_State *L) {
return 1;
}
+static int readcardinal3_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+2 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int c = uchar(s[p]);
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
+ }
+ return 1;
+}
+
static int readcardinal4(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -164,6 +202,22 @@ static int readcardinal4(lua_State *L) {
return 1;
}
+static int readcardinal4_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+3 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int c = uchar(s[p++]);
+ int d = uchar(s[p]);
+ lua_pushinteger(L,0x1000000 * a + 0x10000 * b + 0x100 * c + d);
+ }
+ return 1;
+}
+
static int readinteger1(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -176,6 +230,22 @@ static int readinteger1(lua_State *L) {
return 1;
}
+static int readinteger1_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, a - 0x100);
+ else
+ lua_pushinteger(L, a);
+ }
+ return 1;
+}
+
static int readinteger2(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -189,6 +259,23 @@ static int readinteger2(lua_State *L) {
return 1;
}
+static int readinteger2_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+1 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, 0x100 * a + b - 0x10000);
+ else
+ lua_pushinteger(L, 0x100 * a + b);
+ }
+ return 1;
+}
+
static int readinteger3(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -203,6 +290,24 @@ static int readinteger3(lua_State *L) {
return 1;
}
+static int readinteger3_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+2 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int c = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c - 0x1000000);
+ else
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
+ }
+ return 1;
+}
+
static int readinteger4(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -218,6 +323,25 @@ static int readinteger4(lua_State *L) {
return 1;
}
+static int readinteger4_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+3 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int c = uchar(s[p++]);
+ int d = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, 0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000);
+ else
+ lua_pushinteger(L, 0x1000000 * a + 0x10000 * b + 0x100 * c + d);
+ }
+ return 1;
+}
+
static int readfixed2(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -225,9 +349,26 @@ static int readfixed2(lua_State *L) {
if (b == EOF)
lua_pushnil(L);
else if (a >= 0x80)
- lua_pushinteger(L, a + b/0xFFFF - 0x100);
+ lua_pushinteger(L, (a - 0x100) + b/0x100);
else
- lua_pushinteger(L, a + b/0xFFFF);
+ lua_pushinteger(L, (a ) + b/0x100);
+ return 1;
+}
+
+static int readfixed2_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+3 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, (a - 0x100) + b/0x100);
+ else
+ lua_pushinteger(L, (a ) + b/0x100);
+ }
return 1;
}
@@ -240,15 +381,34 @@ static int readfixed4(lua_State *L) {
if (d == EOF)
lua_pushnil(L);
else if (a >= 0x80)
- lua_pushnumber(L, (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0);
+ lua_pushnumber(L, (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000);
else
- lua_pushnumber(L, (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0);
+ lua_pushnumber(L, (0x100 * a + b ) + (0x100 * c + d)/0x10000);
/* from ff */
/* int n = 0x1000000 * a + 0x10000 * b + 0x100 * c + d; */
/* lua_pushnumber(L,(real) (n>>16) + ((n&0xffff)/65536.0)); */
return 1;
}
+static int readfixed4_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+3 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int c = uchar(s[p++]);
+ int d = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushnumber(L, (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000);
+ else
+ lua_pushnumber(L, (0x100 * a + b ) + (0x100 * c + d)/0x10000);
+ }
+ return 1;
+}
+
static int read2dot14(lua_State *L) {
FILE *f = tofile(L);
int a = getc(f);
@@ -263,6 +423,21 @@ static int read2dot14(lua_State *L) {
return 1;
}
+static int read2dot14_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p < 0 || p+1 >= l) {
+ lua_pushnil(L);
+ } else {
+ int a = uchar(s[p++]);
+ int b = uchar(s[p]);
+ int n = 0x100 * a + b;
+ lua_pushnumber(L,(real) ((n<<16)>>(16+14)) + ((n&0x3fff)/16384.0));
+ }
+ return 1;
+}
+
static int getposition(lua_State *L) {
FILE *f = tofile(L);
long p = ftell(f);
@@ -317,6 +492,28 @@ static int readbytetable(lua_State *L) {
return 1;
}
+static int readbytetable_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ int n = lua_tointeger(L,3);
+ if (p < 0 || p >= l) {
+ lua_pushnil(L);
+ } else {
+ int i ;
+ if (p + n >= l) {
+ n = l - p ;
+ }
+ lua_createtable(L, n, 0);
+ for (i=1;i<=n;i++) {
+ int a = uchar(s[p++]);
+ lua_pushinteger(L, a);
+ lua_rawseti(L,-2,i);
+ }
+ }
+ return 1;
+}
+
static int readbytes(lua_State *L) {
FILE *f = tofile(L);
int n = lua_tointeger(L,2);
@@ -332,6 +529,27 @@ static int readbytes(lua_State *L) {
return n;
}
+static int readbytes_s(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ int n = lua_tointeger(L,3);
+ if (p < 0 || p >= l) {
+ return 0;
+ } else {
+ int i ;
+ if (p + n >= l) {
+ n = l - p ;
+ }
+ lua_createtable(L, n, 0);
+ for (i=1;i<=n;i++) {
+ int a = uchar(s[p++]);
+ lua_pushinteger(L, a);
+ }
+ return n;
+ }
+}
+
static int recordfilename(lua_State *L)
{
const char *fname = luaL_checkstring(L, 1);
@@ -374,11 +592,17 @@ static int checkpermission(lua_State *L)
lua_pushboolean(L,0);
lua_pushliteral(L, "specific command execution disabled");
break;
+ case 1:
+ /* doesn't happen */
+ lua_pushboolean(L,1);
+ lua_pushstring(L,filename);
+ break;
case 2:
lua_pushboolean(L,1);
lua_pushstring(L,safecmd);
break;
default:
+ /* -1 */
lua_pushboolean(L,0);
lua_pushliteral(L, "bad command line quoting");
break;
@@ -444,7 +668,35 @@ static const luaL_Reg fiolib[] = {
{NULL, NULL}
};
+static const luaL_Reg siolib[] = {
+ { "readcardinal1", readcardinal1_s },
+ { "readcardinal2", readcardinal2_s },
+ { "readcardinal3", readcardinal3_s },
+ { "readcardinal4", readcardinal4_s },
+ { "readinteger1", readinteger1_s },
+ { "readinteger2", readinteger2_s },
+ { "readinteger3", readinteger3_s },
+ { "readinteger4", readinteger4_s },
+ { "readfixed2", readfixed2_s },
+ { "readfixed4", readfixed4_s },
+ { "read2dot14", read2dot14_s },
+ { "readbytes", readbytes_s },
+ { "readbytetable", readbytetable_s },
+ /* done */
+ {NULL, NULL}
+};
+
+/*
+ The sio helpers are experimental and might be handy at some point. Speed-wise
+ there is no gain over file access because with ssd and caching we basically
+ operate in memory too. We keep them as complement to the file ones. I did
+ consider using an userdata object for the position etc but some simple tests
+ demonstrated that there is no real gain and the current ones permits to wrap
+ up whatever interface one likes.
+*/
+
int luaopen_fio(lua_State *L) {
luaL_register(L, "fio", fiolib);
+ luaL_register(L, "sio", siolib);
return 1;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/llualib.c b/Build/source/texk/web2c/luatexdir/lua/llualib.c
index c094c8ed1d1..461c211472d 100644
--- a/Build/source/texk/web2c/luatexdir/lua/llualib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/llualib.c
@@ -286,8 +286,7 @@ static int set_luaname(lua_State * L)
static int get_luaname(lua_State * L)
{
- int k;
- k = (int) luaL_checkinteger(L, 2);
+ int k = (int) luaL_checkinteger(L, 2);
if (k > 65535 || k < 0) {
/* error */
lua_pushnil(L);
@@ -306,6 +305,13 @@ static int lua_functions_get_table(lua_State * L) /* hh */
return 1;
}
+static int new_table(lua_State * L) /* hh */
+{
+ int i = (int) luaL_checkinteger(L, 1);
+ int h = (int) luaL_checkinteger(L, 2);
+ lua_createtable(L,i,h);
+ return 1;
+}
static const struct luaL_Reg lualib[] = {
/* *INDENT-OFF* */
@@ -313,6 +319,7 @@ static const struct luaL_Reg lualib[] = {
{"setluaname", set_luaname},
{"getbytecode", get_bytecode},
{"setbytecode", set_bytecode},
+ {"newtable", new_table},
{"get_functions_table",lua_functions_get_table},
/* *INDENT-ON* */
{NULL, NULL} /* sentinel */
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index 49929fa2792..5ee46a7269d 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -268,6 +268,19 @@ static int get_valid_node_subtype_id(lua_State * L, int n)
return i;
}
+/* enable fixer ... more fixers can be added in the future */
+
+static int lua_nodelib_fix_node_lists(lua_State * L)
+{
+ if (lua_type(L, -1) == LUA_TBOOLEAN) {
+ fix_node_lists = lua_toboolean(L,-1);
+ } else if (lua_type(L, -1) == LUA_TNUMBER) {
+ fix_node_lists = lua_tointeger(L,-1);
+ }
+ return 0;
+}
+
+
/* two simple helpers to speed up and simplify lua code (replaced by getnext and getprev) */
static int lua_nodelib_next(lua_State * L)
@@ -438,6 +451,8 @@ static int lua_nodelib_direct_getfont(lua_State * L)
lua_pushinteger(L, font(n));
} else if ((t == math_char_node) || (t == math_text_char_node)) {
lua_pushinteger(L, fam_fnt(math_fam(n), 0));
+ } else if (t == delim_node) {
+ lua_pushinteger(L, fam_fnt(small_fam(n), 0));
} else {
lua_pushnil(L);
}
@@ -473,6 +488,8 @@ static int lua_nodelib_direct_setfont(lua_State * L)
lua_pushinteger(L, font(*n));
} else if ((t == math_char_node) || (t == math_text_char_node)) {
lua_pushinteger(L, fam_fnt(math_fam(*n), 0));
+ } else if (t == delim_node) {
+ lua_pushinteger(L, fam_fnt(small_fam(*n), 0));
} else {
lua_pushnil(L);
}
@@ -492,6 +509,27 @@ static int lua_nodelib_direct_getchar(lua_State * L)
lua_pushinteger(L, character(n));
} else if ((t == math_char_node) || (t == math_text_char_node)) {
lua_pushinteger(L, math_character(n));
+ } else if (t == delim_node) {
+ /* used in wide fonts */
+ lua_pushinteger(L, small_char(n));
+ } else {
+ lua_pushnil(L);
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
+static int lua_nodelib_direct_getfam(lua_State * L)
+{
+ halfword n = lua_tointeger(L, 1);
+ if (n) {
+ halfword t = type(n);
+ if ((t == math_char_node) || (t == math_text_char_node)) {
+ lua_pushinteger(L, math_fam(n));
+ } else if (t == delim_node) {
+ lua_pushinteger(L, small_fam(n));
} else {
lua_pushnil(L);
}
@@ -510,23 +548,47 @@ static int lua_nodelib_direct_setchar(lua_State * L)
character(n) = (halfword) lua_tointeger(L, 2);
} else if ((t == math_char_node) || (t == math_text_char_node)) {
math_character(n) = (halfword) lua_tointeger(L, 2);
+ } else if (t == delim_node) {
+ /* used in wide fonts */
+ small_char(n) = (halfword) lua_tointeger(L, 2);
}
}
return 0;
}
+static int lua_nodelib_direct_setfam(lua_State * L)
+{
+ halfword n = lua_tointeger(L, 1);
+ if ((n) && (lua_type(L, 2) == LUA_TNUMBER)) {
+ halfword t = type(n);
+ if ((t == math_char_node) || (t == math_text_char_node)) {
+ math_fam(n) = (halfword) lua_tointeger(L, 2);
+ } else if (t == delim_node) {
+ small_fam(n) = (halfword) lua_tointeger(L, 2);
+ }
+ }
+ return 0;
+}
/* node.getchar */
static int lua_nodelib_getchar(lua_State * L)
{
halfword *n = lua_touserdata(L, 1);
- if ( (n == NULL) || (! lua_getmetatable(L,1)) ) {
+ if ((n == NULL) || (! lua_getmetatable(L,1))) {
lua_pushnil(L);
- } else if (type(*n) == glyph_node) {
- lua_pushinteger(L, character(*n));
- } else if ((type(*n) == math_char_node) || (type(*n) == math_text_char_node)) {
- lua_pushinteger(L, math_character(*n));
+ } else {
+ halfword t = type(*n);
+ if (t == glyph_node) {
+ lua_pushinteger(L, character(*n));
+ } else if ((t == math_char_node) || (t == math_text_char_node)) {
+ lua_pushinteger(L, math_character(*n));
+ } else if (t == delim_node) {
+ /* used in wide fonts */
+ lua_pushinteger(L, small_char(*n));
+ } else {
+ lua_pushnil(L);
+ }
}
return 1;
}
@@ -673,7 +735,7 @@ static int lua_nodelib_direct_getnucleus(lua_State * L)
if (n) {
halfword t = type(n);
if (t == simple_noad || t == accent_noad || t == radical_noad) {
- lua_pushinteger(L, nucleus(n));
+ nodelib_pushdirect_or_nil(nucleus(n));
return 1;
}
}
@@ -703,7 +765,7 @@ static int lua_nodelib_direct_getsub(lua_State * L)
if (n) {
halfword t = type(n);
if (t == simple_noad || t == accent_noad || t == radical_noad) {
- lua_pushinteger(L, subscr(n));
+ nodelib_pushdirect_or_nil(subscr(n));
return 1;
}
}
@@ -733,7 +795,7 @@ static int lua_nodelib_direct_getsup(lua_State * L)
if (n) {
halfword t = type(n);
if (t == simple_noad || t == accent_noad || t == radical_noad) {
- lua_pushinteger(L, supscr(n));
+ nodelib_pushdirect_or_nil(supscr(n));
return 1;
}
}
@@ -785,7 +847,7 @@ static int lua_nodelib_direct_setkern(lua_State * L)
halfword t = type(n);
if (t == kern_node || t == margin_kern_node) {
if (lua_type(L, 2) == LUA_TNUMBER) {
- width(n) = (halfword) lua_tointeger(L, 2);
+ width(n) = (halfword) lua_roundnumber(L, 2);
} else {
width(n) = 0;
}
@@ -794,7 +856,7 @@ static int lua_nodelib_direct_setkern(lua_State * L)
}
} else if (t == math_node) {
if (lua_type(L, 2) == LUA_TNUMBER) {
- surround(n) = (halfword) lua_tointeger(L, 2);
+ surround(n) = (halfword) lua_roundnumber(L, 2);
} else {
surround(n) = 0;
}
@@ -867,10 +929,10 @@ static int lua_nodelib_direct_setoffsets(lua_State * L)
halfword n = lua_tointeger(L, 1);
if ((n) && (type(n) == glyph_node)) {
if ((lua_type(L, 2) == LUA_TNUMBER)) {
- x_displace(n) = (halfword) lua_tointeger(L, 2);
+ x_displace(n) = (halfword) lua_roundnumber(L, 2);
}
if ((lua_type(L, 3) == LUA_TNUMBER)) {
- y_displace(n) = (halfword) lua_tointeger(L, 3);
+ y_displace(n) = (halfword) lua_roundnumber(L, 3);
}
}
return 0;
@@ -1071,6 +1133,8 @@ static int lua_nodelib_direct_getlist(lua_State * L)
nodelib_pushdirect_or_nil_alink(list_ptr(n));
} else if ((t == sub_box_node) || (t == sub_mlist_node)) {
nodelib_pushdirect_or_nil_alink(math_list(n));
+ } else if (t == ins_node) {
+ nodelib_pushdirect_or_nil_alink(ins_ptr(n));
} else if (t == adjust_node) {
nodelib_pushdirect_or_nil_alink(adjust_ptr(n));
} else {
@@ -1097,6 +1161,12 @@ static int lua_nodelib_direct_setlist(lua_State * L)
} else {
math_list(n) = null;
}
+ } else if (t == ins_node) {
+ if (lua_type(L,2) == LUA_TNUMBER) {
+ ins_ptr(n) = (halfword) lua_tointeger(L, 2);
+ } else {
+ ins_ptr(n) = null;
+ }
} else if (t == adjust_node) {
if (lua_type(L,2) == LUA_TNUMBER) {
adjust_ptr(n) = (halfword) lua_tointeger(L, 2);
@@ -1120,6 +1190,10 @@ static int lua_nodelib_direct_setlist(lua_State * L)
fast_metatable_or_nil_alink(list_ptr(*n));
} else if ((type(*n) == sub_box_node) || (type(*n) == sub_mlist_node)) {
fast_metatable_or_nil_alink(math_list(*n));
+ } else if (type(*n) == ins_node) {
+ fast_metatable_or_nil_alink(ins_ptr(*n));
+ } else if (type(*n) == adjust_node) {
+ fast_metatable_or_nil_alink(adjust_ptr(*n));
} else {
lua_pushnil(L);
}
@@ -2999,7 +3073,7 @@ static int lua_nodelib_direct_setwidth(lua_State * L)
if (t == hlist_node || t == vlist_node || t == rule_node || t == glue_node || t == glue_spec_node || t == math_node ||
t == kern_node || t == margin_kern_node || t == ins_node || t == unset_node) {
if (lua_type(L, 2) == LUA_TNUMBER) {
- width(n) = lua_tointeger(L,2);
+ width(n) = lua_roundnumber(L,2);
} else {
width(n) = 0;
}
@@ -3035,7 +3109,7 @@ static int lua_nodelib_direct_setheight(lua_State * L)
halfword t = type(n);
if (t == hlist_node || t == vlist_node || t == rule_node || t == unset_node) {
if (lua_type(L, 2) == LUA_TNUMBER) {
- height(n) = lua_tointeger(L,2);
+ height(n) = lua_roundnumber(L,2);
} else {
height(n) = 0;
}
@@ -3071,7 +3145,7 @@ static int lua_nodelib_direct_setdepth(lua_State * L)
halfword t = type(n);
if (t == hlist_node || t == vlist_node || t == rule_node || t == unset_node) {
if (lua_type(L, 2) == LUA_TNUMBER) {
- depth(n) = lua_tointeger(L,2);
+ depth(n) = lua_roundnumber(L,2);
} else {
depth(n) = 0;
}
@@ -3104,7 +3178,7 @@ static int lua_nodelib_direct_setshift(lua_State * L)
halfword t = type(n);
if (t == hlist_node || t == vlist_node) {
if (lua_type(L, 2) == LUA_TNUMBER) {
- shift_amount(n) = lua_tointeger(L,2);
+ shift_amount(n) = lua_roundnumber(L,2);
} else {
shift_amount(n) = 0;
}
@@ -3129,6 +3203,11 @@ static int lua_nodelib_direct_get_glue(lua_State * L)
lua_pushinteger(L,stretch_order(n));
lua_pushinteger(L,shrink_order(n));
return 5;
+ } else if (t == hlist_node || t == vlist_node) {
+ lua_pushnumber(L, (double) glue_set(n)); /* float */
+ lua_pushinteger(L,glue_order(n));
+ lua_pushinteger(L,glue_sign(n));
+ return 3;
}
}
return 0;
@@ -3146,6 +3225,11 @@ static int lua_nodelib_direct_set_glue(lua_State * L)
shrink(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_roundnumber(L,4) : 0;
stretch_order(n) = ((top > 4 && lua_type(L, 5) == LUA_TNUMBER)) ? lua_tointeger(L,5) : 0;
shrink_order(n) = ((top > 5 && lua_type(L, 6) == LUA_TNUMBER)) ? lua_tointeger(L,6) : 0;
+ } else if (t == hlist_node || t == vlist_node) {
+ glue_set(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? (glue_ratio) lua_tonumber(L,2) : 0;
+ glue_order(n) = ((top > 2 && lua_type(L, 3) == LUA_TNUMBER)) ? lua_tointeger(L,3) : 0;
+ glue_sign(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_tointeger(L,4) : 0;
+ return 3;
}
}
return 0;
@@ -3159,9 +3243,12 @@ static int lua_nodelib_direct_is_zero_glue(lua_State * L)
if (t == glue_node || t == glue_spec_node || t == math_node || t == ins_node) {
lua_pushboolean(L,(width(n) == 0 && stretch(n) == 0 && shrink(n) == 0));
return 1;
+ } else if (t == hlist_node || t == vlist_node) {
+ lua_pushboolean(L,(glue_set(n) == 0 && glue_order(n) == 0 && glue_sign(n) == 0));
+ return 1;
}
}
- return luaL_error(L, "glue (spec) expected");
+ return 0;
}
/* node.getglue */
@@ -3173,16 +3260,21 @@ static int lua_nodelib_get_glue(lua_State * L)
halfword n = *check_isnode(L, 1);
if (n) {
halfword t = type(n);
- if (t == glue_node || t == glue_spec_node || t == math_node || t== ins_node) {
+ if (t == glue_node || t == glue_spec_node || t == math_node || t == ins_node) {
lua_pushinteger(L,width(n));
lua_pushinteger(L,stretch(n));
lua_pushinteger(L,shrink(n));
lua_pushinteger(L,stretch_order(n));
lua_pushinteger(L,shrink_order(n));
return 5;
+ } else if (t == hlist_node || t == vlist_node) {
+ lua_pushnumber(L, (double) glue_set(n)); /* float */
+ lua_pushinteger(L,glue_order(n));
+ lua_pushinteger(L,glue_sign(n));
+ return 3;
}
}
- return luaL_error(L, "glue (spec) expected");
+ return luaL_error(L, "glue (spec) or list expected");
}
static int lua_nodelib_set_glue(lua_State * L)
@@ -3197,20 +3289,31 @@ static int lua_nodelib_set_glue(lua_State * L)
shrink(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_roundnumber(L,4) : 0;
stretch_order(n) = ((top > 4 && lua_type(L, 5) == LUA_TNUMBER)) ? lua_tointeger(L,5) : 0;
shrink_order(n) = ((top > 5 && lua_type(L, 6) == LUA_TNUMBER)) ? lua_tointeger(L,6) : 0;
+ } else if (t == hlist_node || t == vlist_node) {
+ glue_set(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? (glue_ratio) lua_tonumber(L,2) : 0;
+ glue_order(n) = ((top > 2 && lua_type(L, 3) == LUA_TNUMBER)) ? lua_tointeger(L,3) : 0;
+ glue_sign(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_tointeger(L,4) : 0;
+ return 3;
}
- return 0;
+ return 0;
}
- return luaL_error(L, "glue (spec) expected");
+ return luaL_error(L, "glue (spec) or list expected");
}
static int lua_nodelib_is_zero_glue(lua_State * L)
{
halfword n = *check_isnode(L, 1);
- if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node || type(n) == math_node || type(n) == ins_node)) {
- lua_pushboolean(L,(width(n) == 0 && stretch(n) == 0 && shrink(n) == 0));
- return 1;
+ if (n != null) {
+ halfword t = type(n);
+ if (t == glue_node || t == glue_spec_node || t == math_node || t == ins_node) {
+ lua_pushboolean(L,(width(n) == 0 && stretch(n) == 0 && shrink(n) == 0));
+ return 1;
+ } else if (t == hlist_node || t == vlist_node) {
+ lua_pushboolean(L,(glue_set(n) == 0 && glue_order(n) == 0 && glue_sign(n) == 0));
+ return 1;
+ }
}
- return luaL_error(L, "glue (spec) expected");
+ return luaL_error(L, "glue (spec) or list expected");
}
/* iteration */
@@ -4051,6 +4154,8 @@ static int lua_nodelib_fast_getfield(lua_State * L)
fast_metatable_or_nil(subscr(n));
} else if (lua_key_eq(s, sup)) {
fast_metatable_or_nil(supscr(n));
+ } else if (lua_key_eq(s, options)) {
+ lua_pushinteger(L, noadoptions(n));
} else {
lua_pushnil(L);
}
@@ -4788,6 +4893,8 @@ static int lua_nodelib_direct_getfield(lua_State * L)
nodelib_pushdirect_or_nil(subscr(n));
} else if (lua_key_eq(s, sup)) {
nodelib_pushdirect_or_nil(supscr(n));
+ } else if (lua_key_eq(s, options)) {
+ lua_pushinteger(L, noadoptions(n));
} else {
lua_pushnil(L);
}
@@ -4835,7 +4942,7 @@ static int lua_nodelib_direct_getfield(lua_State * L)
} else if (t == math_node) {
if (lua_key_eq(s, surround)) {
lua_pushinteger(L, surround(n));
- /* glue */
+ /* glue */
} else if (lua_key_eq(s, width)) {
lua_pushinteger(L, width(n));
} else if (lua_key_eq(s, stretch)) {
@@ -5258,111 +5365,169 @@ static int font_tex_direct_kerning(lua_State * L)
}
/* node.protect_glyphs (returns also boolean because that signals callback) */
+/* node.unprotect_glyphs (returns also boolean because that signals callback) */
+
+#define protect_one_indeed(n) \
+ if (n != null) { \
+ int s = subtype(n); \
+ if (s <= 256) { \
+ subtype(n) = (quarterword) (s == 1 ? 256 : 256 + s); \
+ } \
+ }
+
+#define protect_all_indeed(n) \
+ h = n ; \
+ if (h != null) { \
+ while (h != null) { \
+ if (type(h) == glyph_node) { \
+ int s = subtype(h); \
+ if (s <= 256) { \
+ subtype(h) = (quarterword) (s == 1 ? 256 : 256 + s); \
+ } \
+ } \
+ h = vlink(h); \
+ } \
+ }
+
+#define protect_node_indeed(n) \
+ if (type(n) == glyph_node) { \
+ protect_one_indeed(n); \
+ } else if (type(n) == disc_node) { \
+ protect_all_indeed(vlink(no_break(n))); \
+ protect_all_indeed(vlink(pre_break(n))); \
+ protect_all_indeed(vlink(post_break(n))); \
+ }
+
+#define unprotect_one_indeed(n) \
+ if (n != null) { \
+ int s = subtype(n); \
+ if (s > 256) { \
+ subtype(n) = (quarterword) (s - 256); \
+ } \
+ }
+
+#define unprotect_all_indeed(n) \
+ h = n ; \
+ if (h != null) { \
+ while (h != null) { \
+ if (type(h) == glyph_node) { \
+ int s = subtype(h); \
+ if (s <= 256) { \
+ subtype(h) = (quarterword) (s - 256); \
+ } \
+ } \
+ h = vlink(h); \
+ } \
+ }
+
+#define unprotect_node_indeed(n) \
+ if (type(n) == glyph_node) { \
+ unprotect_one_indeed(n); \
+ } else if (type(n) == disc_node) { \
+ unprotect_all_indeed(vlink(no_break(n))); \
+ unprotect_all_indeed(vlink(pre_break(n))); \
+ unprotect_all_indeed(vlink(post_break(n))); \
+ }
+
+static int lua_nodelib_protect_glyph(lua_State * L)
+{
+ halfword n = *check_isnode(L, 1);
+ halfword h;
+ protect_node_indeed(n);
+ return 0;
+}
+
+static int lua_nodelib_unprotect_glyph(lua_State * L)
+{
+ halfword n = *check_isnode(L, 1);
+ halfword h;
+ unprotect_node_indeed(n);
+ return 0;
+}
static int lua_nodelib_protect_glyphs(lua_State * L)
{
- int t = 0;
halfword head = *check_isnode(L, 1);
+ halfword tail = null;
+ halfword h;
+ if (lua_gettop(L) > 1) {
+ tail = *check_isnode(L, 2);
+ }
while (head != null) {
- if (type(head) == glyph_node) {
- int s = subtype(head);
- if (s <= 256) {
- t = 1;
- subtype(head) = (quarterword) (s == 1 ? 256 : 256 + s);
- }
+ protect_node_indeed(head);
+ if (head == tail) {
+ break;
}
head = vlink(head);
}
- lua_pushboolean(L, t);
- lua_pushvalue(L, 1);
- return 2;
+ return 0;
}
-static int lua_nodelib_protect_glyph(lua_State * L)
+static int lua_nodelib_unprotect_glyphs(lua_State * L)
{
- halfword n = *check_isnode(L, 1);
- if (type(n) == glyph_node) {
- int s = subtype(n);
- if (s <= 256) {
- subtype(n) = (quarterword) (s == 1 ? 256 : 256 + s);
+ halfword head = *check_isnode(L, 1);
+ halfword tail = null;
+ halfword h;
+ if (lua_gettop(L) > 1) {
+ tail = *check_isnode(L, 2);
+ }
+ while (head != null) {
+ unprotect_node_indeed(head);
+ if (head == tail) {
+ break;
}
+ head = vlink(head);
}
return 0;
}
/* node.direct.protect_glyphs */
+/* node.direct.unprotect_glyphs */
-static int lua_nodelib_direct_protect_glyphs(lua_State * L)
+static int lua_nodelib_direct_protect_glyph(lua_State * L)
{
- int t = 0;
- halfword head = (halfword) lua_tointeger(L,1);
- while (head != null) {
- if (type(head) == glyph_node) {
- int s = subtype(head);
- if (s <= 256) {
- t = 1;
- subtype(head) = (quarterword) (s == 1 ? 256 : 256 + s);
- }
- }
- head = vlink(head);
- }
- lua_pushboolean(L, t);
- lua_pushvalue(L, 1);
- return 2;
+ halfword n = (halfword) lua_tointeger(L,1);
+ halfword h;
+ protect_node_indeed(n);
+ return 0;
}
-static int lua_nodelib_direct_protect_glyph(lua_State * L)
+static int lua_nodelib_direct_unprotect_glyph(lua_State * L)
{
halfword n = (halfword) lua_tointeger(L,1);
- if ((n != null) && (type(n) == glyph_node)) {
- int s = subtype(n);
- if (s <= 256) {
- subtype(n) = (quarterword) (s == 1 ? 256 : 256 + s);
- }
- }
+ halfword h;
+ unprotect_node_indeed(n);
return 0;
}
-/* node.unprotect_glyphs (returns also boolean because that signals callback) */
-
-static int lua_nodelib_unprotect_glyphs(lua_State * L)
+static int lua_nodelib_direct_protect_glyphs(lua_State * L)
{
- int t = 0;
- halfword head = *(check_isnode(L, 1));
+ halfword head = (halfword) lua_tointeger(L,1);
+ halfword tail = (halfword) lua_tointeger(L,2);
+ halfword h;
while (head != null) {
- if (type(head) == glyph_node) {
- int s = subtype(head);
- if (s > 256) {
- t = 1;
- subtype(head) = (quarterword) (s - 256);
- }
+ protect_node_indeed(head);
+ if (head == tail) {
+ break;
}
head = vlink(head);
}
- lua_pushboolean(L, t);
- lua_pushvalue(L, 1);
- return 2;
+ return 0;
}
-/* node.direct.unprotect_glyphs */
-
static int lua_nodelib_direct_unprotect_glyphs(lua_State * L)
{
- int t = 0;
halfword head = (halfword) lua_tointeger(L,1);
+ halfword tail = (halfword) lua_tointeger(L,2);
+ halfword h;
while (head != null) {
- if (type(head) == glyph_node) {
- int s = subtype(head);
- if (s > 256) {
- t = 1;
- subtype(head) = (quarterword) (s - 256);
- }
+ unprotect_node_indeed(head);
+ if (head == tail) {
+ break;
}
head = vlink(head);
}
- lua_pushboolean(L, t);
- lua_pushvalue(L, 1);
- return 2;
+ return 0;
}
/* node.first_glyph */
@@ -6100,6 +6265,8 @@ static int lua_nodelib_fast_setfield(lua_State * L)
subscr(n) = nodelib_getlist(L, 3);
} else if (lua_key_eq(s, sup)) {
supscr(n) = nodelib_getlist(L, 3);
+ } else if (lua_key_eq(s, options)) {
+ noadoptions(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -6690,6 +6857,55 @@ static int lua_nodelib_direct_is_glyph(lua_State * L)
return 2;
}
+/* uses_font */
+/* direct.uses_font */
+
+#define uses_font_disc(what,p,n) \
+p = vlink(what(n)); \
+while (p) { \
+ if ((type(p) == glyph_node) && (font(p) == f)) { \
+ lua_pushboolean(L,1); \
+ return 1; \
+ } \
+ p = vlink(p); \
+}
+
+
+static int lua_nodelib_direct_uses_font(lua_State * L)
+{
+ halfword n = lua_tointeger(L,1);
+ halfword f = lua_tointeger(L,2);
+ halfword p;
+ if (type(n) == glyph_node) {
+ lua_pushboolean(L,font(n) == f);
+ } else if (type(n) == disc_node) {
+ uses_font_disc(pre_break,p,n);
+ uses_font_disc(post_break,p,n);
+ uses_font_disc(no_break,p,n);
+ }
+ /* todo: other node types */
+ lua_pushboolean(L,0);
+ return 1;
+}
+
+static int lua_nodelib_uses_font(lua_State * L)
+{
+ halfword n = *check_isnode(L, 1);
+ halfword f = lua_tointeger(L,2);
+ halfword p;
+ if (type(n) == glyph_node) {
+ lua_pushboolean(L,font(n) == f);
+ } else if (type(n) == disc_node) {
+ uses_font_disc(pre_break,p,n);
+ uses_font_disc(post_break,p,n);
+ uses_font_disc(no_break,p,n);
+ }
+ /* todo: other node types */
+ lua_pushboolean(L,0);
+ return 1;
+}
+
+
/* direct.setfield */
static int lua_nodelib_direct_setfield(lua_State * L)
@@ -6905,6 +7121,8 @@ static int lua_nodelib_direct_setfield(lua_State * L)
subscr(n) = nodelib_popdirect(3);
} else if (lua_key_eq(s, sup)) {
supscr(n) = nodelib_popdirect(3);
+ } else if (lua_key_eq(s, options)) {
+ noadoptions(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -6939,7 +7157,7 @@ static int lua_nodelib_direct_setfield(lua_State * L)
height(n) = (halfword) lua_roundnumber(L, 3);
} else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) {
ins_ptr(n) = nodelib_popdirect(3);
- /* glue */
+ /* glue */
} else if (lua_key_eq(s, width)) {
width(n) = (halfword) lua_roundnumber(L, 3);
} else if (lua_key_eq(s, stretch)) {
@@ -6958,7 +7176,7 @@ static int lua_nodelib_direct_setfield(lua_State * L)
subtype(n) = (quarterword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, surround)) {
surround(n) = (halfword) lua_roundnumber(L, 3);
- /* glue */
+ /* glue */
} else if (lua_key_eq(s, width)) {
width(n) = (halfword) lua_roundnumber(L, 3);
} else if (lua_key_eq(s, stretch)) {
@@ -7481,20 +7699,20 @@ static int lua_nodelib_effective_glue(lua_State * L)
if ((glue == NULL) || (type(*glue) != glue_node)) {
lua_pushnil(L) ;
} else {
- int w = width(*glue) ;
+ double w = width(*glue) ;
parent = lua_touserdata(L, 2);
if ((parent != NULL) && ((type(*parent) == hlist_node) || (type(*parent) == vlist_node))) {
- if ((int)glue_sign(*parent) == 1) {
+ if ((int) glue_sign(*parent) == 1) {
if (stretch_order(*glue) == glue_order(*parent)) {
- w += stretch(*glue) * glue_set(*parent);
+ w += stretch(*glue) * (double) glue_set(*parent);
}
} else if (glue_sign(*parent) == 2) {
if (shrink_order(*glue) == glue_order(*parent)) {
- w -= shrink(*glue) * glue_set(*parent);
+ w -= shrink(*glue) * (double) glue_set(*parent);
}
}
}
- lua_pushinteger(L,w);
+ lua_pushinteger(L,round(w));
}
return 1;
}
@@ -7505,20 +7723,20 @@ static int lua_nodelib_direct_effective_glue(lua_State * L)
if ((glue == null) || (type(glue) != glue_node)) {
lua_pushnil(L) ;
} else {
- int w = width(glue) ;
+ double w = (double) width(glue) ;
halfword parent = lua_tointeger(L, 2);
if ((parent != null) && ((type(parent) == hlist_node) || (type(parent) == vlist_node))) {
if ((int)glue_sign(parent) == 1) {
if (stretch_order(glue) == glue_order(parent)) {
- w += stretch(glue) * glue_set(parent);
+ w += stretch(glue) * (double) glue_set(parent);
}
} else if (glue_sign(parent) == 2) {
if (shrink_order(glue) == glue_order(parent)) {
- w -= shrink(glue) * glue_set(parent);
+ w -= shrink(glue) * (double) glue_set(parent);
}
}
}
- lua_pushinteger(L,w);
+ lua_pushnumber(L,round(w));
}
return 1;
}
@@ -7563,6 +7781,46 @@ static int lua_nodelib_direct_check_discretionary(lua_State * L) {
return 0;
}
+static int lua_nodelib_direct_flatten_discretionaries(lua_State * L)
+{
+ halfword head = lua_tointeger(L, 1);
+ halfword current = head;
+ halfword next;
+ halfword d, n, h, t;
+ int c = 0;
+ while (current != null) {
+ next = vlink(current);
+ if (type(current) == disc_node) {
+ ++c;
+ d = current;
+ n = no_break(d);
+ h = vlink(n);
+ t = tlink(n);
+ if (h != null) {
+ try_couple_nodes(t,next);
+ if (current == head) {
+ head = h;
+ } else {
+ try_couple_nodes(alink(current),h);
+ }
+ vlink(n) = null ;
+ //tlink(n) = null;
+ } else {
+ if (current == head) {
+ head = next;
+ } else {
+ try_couple_nodes(alink(current),next);
+ }
+ }
+ flush_node(d);
+ }
+ current = next;
+ }
+ nodelib_pushdirect_or_nil(head);
+ lua_pushinteger(L,c);
+ return 2;
+}
+
static int lua_nodelib_check_discretionaries(lua_State * L) {
halfword c = *check_isnode(L, 1);
halfword p ;
@@ -7588,6 +7846,129 @@ static int lua_nodelib_check_discretionary(lua_State * L) {
return 0;
}
+static int lua_nodelib_flatten_discretionaries(lua_State * L)
+{
+ halfword head = *check_isnode(L, 1);
+ halfword current = head;
+ halfword next;
+ halfword d, n, h, t;
+ halfword *a;
+ int c = 0;
+ while (current != null) {
+ next = vlink(current);
+ if (type(current) == disc_node) {
+ ++c;
+ d = current;
+ n = no_break(d);
+ h = vlink(n);
+ t = tlink(n);
+ if (h != null) {
+ try_couple_nodes(t,next);
+ if (current == head) {
+ head = h;
+ } else {
+ try_couple_nodes(alink(current),h);
+ }
+ vlink(n) = null ;
+ //tlink(n) = null;
+ } else {
+ if (current == head) {
+ head = next;
+ } else {
+ try_couple_nodes(alink(current),next);
+ }
+ }
+ flush_node(d);
+ }
+ current = next;
+ }
+ fast_metatable_or_nil(head);
+ lua_pushinteger(L,c);
+ return 2;
+}
+
+/* synctex but not */
+
+static int lua_nodelib_direct_set_synctex_fields(lua_State * L)
+{
+ halfword n = lua_tointeger(L, 1);
+ halfword tag = lua_tointeger(L, 2);
+ halfword line = lua_tointeger(L, 3);
+ if (n != null) {
+ switch (type(n)) {
+ case glyph_node:
+ if (tag) synctex_tag_glyph(n) = tag;
+ if (line) synctex_line_glyph(n) = line;
+ break;
+ case glue_node:
+ if (tag) synctex_tag_glue(n) = tag;
+ if (line) synctex_line_glue(n) = line;
+ break;
+ case kern_node:
+ if (tag) synctex_tag_kern(n) = tag;
+ if (line) synctex_line_kern(n) = line;
+ break;
+ case hlist_node:
+ case vlist_node:
+ case unset_node:
+ if (tag) synctex_tag_box(n) = tag;
+ if (line) synctex_line_box(n) = line;
+ break;
+ case rule_node:
+ if (tag) synctex_tag_rule(n) = tag;
+ if (line) synctex_line_rule(n) = line;
+ break;
+ case math_node:
+ if (tag) synctex_tag_math(n) = tag;
+ if (line) synctex_line_math(n) = line;
+ break;
+ }
+ }
+ return 0;
+}
+
+static int lua_nodelib_direct_get_synctex_fields(lua_State * L)
+{
+ halfword n = lua_tointeger(L, 1);
+ if (n != null) {
+ switch (type(n)) {
+ case glyph_node:
+ lua_pushinteger(L,synctex_tag_glyph(n));
+ lua_pushinteger(L,synctex_line_glyph(n));
+ break;
+ case glue_node:
+ lua_pushinteger(L,synctex_tag_glue(n));
+ lua_pushinteger(L,synctex_line_glue(n));
+ break;
+ case kern_node:
+ lua_pushinteger(L,synctex_tag_kern(n));
+ lua_pushinteger(L,synctex_line_kern(n));
+ break;
+ case hlist_node:
+ case vlist_node:
+ case unset_node:
+ lua_pushinteger(L,synctex_tag_box(n));
+ lua_pushinteger(L,synctex_line_box(n));
+ break;
+ case rule_node:
+ lua_pushinteger(L,synctex_tag_rule(n));
+ lua_pushinteger(L,synctex_line_rule(n));
+ break;
+ case math_node:
+ lua_pushinteger(L,synctex_tag_math(n));
+ lua_pushinteger(L,synctex_line_math(n));
+ break;
+ default:
+ return 0;
+ break;
+ }
+ return 2;
+ }
+ return 0;
+}
+
+/* done */
+
static const struct luaL_Reg nodelib_p[] = {
{"__index", lua_nodelib_get_property_t},
{"__newindex", lua_nodelib_set_property_t},
@@ -7641,6 +8022,7 @@ static const struct luaL_Reg direct_nodelib_f[] = {
{"getshift", lua_nodelib_direct_getshift},
{"getfield", lua_nodelib_direct_getfield},
{"getfont", lua_nodelib_direct_getfont},
+ {"getfam", lua_nodelib_direct_getfam},
{"getid", lua_nodelib_direct_getid},
{"getnext", lua_nodelib_direct_getnext},
{"getprev", lua_nodelib_direct_getprev},
@@ -7659,6 +8041,7 @@ static const struct luaL_Reg direct_nodelib_f[] = {
{"has_field", lua_nodelib_direct_has_field},
{"is_char", lua_nodelib_direct_is_char},
{"is_glyph", lua_nodelib_direct_is_glyph},
+ {"uses_font", lua_nodelib_direct_uses_font},
{"hpack", lua_nodelib_direct_hpack},
/* {"id", lua_nodelib_id}, */ /* no node argument */
{"insert_after", lua_nodelib_direct_insert_after},
@@ -7681,6 +8064,7 @@ static const struct luaL_Reg direct_nodelib_f[] = {
{"setfield", lua_nodelib_direct_setfield},
{"setchar", lua_nodelib_direct_setchar},
{"setfont", lua_nodelib_direct_setfont},
+ {"setfam", lua_nodelib_direct_setfam},
{"setcomponents", lua_nodelib_direct_setcomponents},
{"setlang", lua_nodelib_direct_setlang},
{"setkern", lua_nodelib_direct_setkern},
@@ -7716,6 +8100,7 @@ static const struct luaL_Reg direct_nodelib_f[] = {
/* {"type", lua_nodelib_type}, */ /* no node argument */
/* {"types", lua_nodelib_types}, */ /* no node argument */
{"unprotect_glyphs", lua_nodelib_direct_unprotect_glyphs},
+ {"unprotect_glyph", lua_nodelib_direct_unprotect_glyph},
{"unset_attribute", lua_nodelib_direct_unset_attribute},
{"setglue",lua_nodelib_direct_set_glue},
{"getglue",lua_nodelib_direct_get_glue},
@@ -7732,6 +8117,10 @@ static const struct luaL_Reg direct_nodelib_f[] = {
{"effective_glue", lua_nodelib_direct_effective_glue},
{"check_discretionary", lua_nodelib_direct_check_discretionary},
{"check_discretionaries", lua_nodelib_direct_check_discretionaries},
+ {"flatten_discretionaries",lua_nodelib_direct_flatten_discretionaries},
+ /* done */
+ {"set_synctex_fields", lua_nodelib_direct_set_synctex_fields},
+ {"get_synctex_fields", lua_nodelib_direct_get_synctex_fields},
/* done */
{NULL, NULL} /* sentinel */
};
@@ -7775,6 +8164,7 @@ static const struct luaL_Reg nodelib_f[] = {
{"has_field", lua_nodelib_has_field},
{"is_char", lua_nodelib_is_char},
{"is_glyph", lua_nodelib_is_glyph},
+ {"uses_font", lua_nodelib_uses_font},
{"hpack", lua_nodelib_hpack},
{"id", lua_nodelib_id},
{"insert_after", lua_nodelib_insert_after},
@@ -7804,6 +8194,7 @@ static const struct luaL_Reg nodelib_f[] = {
{"type", lua_nodelib_type},
{"types", lua_nodelib_types},
{"unprotect_glyphs", lua_nodelib_unprotect_glyphs},
+ {"unprotect_glyph", lua_nodelib_unprotect_glyph},
{"unset_attribute", lua_nodelib_unset_attribute},
{"setglue",lua_nodelib_set_glue},
{"getglue",lua_nodelib_get_glue},
@@ -7823,7 +8214,12 @@ static const struct luaL_Reg nodelib_f[] = {
{"effective_glue", lua_nodelib_effective_glue},
{"check_discretionary", lua_nodelib_check_discretionary},
{"check_discretionaries", lua_nodelib_check_discretionaries},
+ {"flatten_discretionaries",lua_nodelib_flatten_discretionaries},
+ /* done */
+ /* {"set_synctex_fields", lua_nodelib_set_synctex_fields}, */
+ /* {"get_synctex_fields", lua_nodelib_get_synctex_fields}, */
/* done */
+ {"fix_node_lists", lua_nodelib_fix_node_lists},
{NULL, NULL} /* sentinel */
};
diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
index f20604ead8f..88f9eac7c24 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
@@ -949,6 +949,25 @@ static int getpdfcreationdate(lua_State * L)
return 1 ;
}
+static int getpdfmajorversion(lua_State * L)
+{
+ /* lua_pushinteger(L,static_pdf->major_version); */
+ lua_pushinteger(L,pdf_major_version);
+ return 1 ;
+}
+
+static int setpdfmajorversion(lua_State * L)
+{
+ if (lua_type(L, 1) == LUA_TNUMBER) {
+ int c = (int) lua_tointeger(L, 1);
+ if ((c >= 1) && (c <= 2)) {
+ static_pdf->major_version = c;
+ set_pdf_major_version(c);
+ }
+ }
+ return 0 ;
+}
+
static int getpdfminorversion(lua_State * L)
{
/* lua_pushinteger(L,static_pdf->minor_version); */
@@ -1199,6 +1218,8 @@ static const struct luaL_Reg pdflib[] = {
{ "xformname", getpdfxformname },
{ "getversion", getpdfversion },
{ "getcreationdate", getpdfcreationdate },
+ { "getmajorversion", getpdfmajorversion },
+ { "setmajorversion", setpdfmajorversion },
{ "getminorversion", getpdfminorversion },
{ "setminorversion", setpdfminorversion },
{ "newcolorstack", newpdfcolorstack },
diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc b/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc
index 8bdbcf16535..eb881b63c3d 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc
@@ -944,7 +944,7 @@ LUALIB_API int luaopen_pdfscanner(lua_State * L)
luaL_openlib(L, 0, scannerlib_meta, 0);
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
- luaL_openlib(L, NULL, scannerlib_m, 0);
+ luaL_register(L, NULL, scannerlib_m);
luaL_register(L, "pdfscanner", scannerlib);
return 1;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
index 6ec2f0bd488..943cd0fb07a 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
@@ -20,6 +20,7 @@
#include "ptexlib.h"
#include "lua/luatex-api.h"
+#include "luatex_svnversion.h"
typedef struct statistic {
const char *name;
@@ -260,6 +261,11 @@ static lua_Number kpse_used_state(void)
}
}
+static lua_Number get_development_id(void)
+{
+ return (lua_Number) luatex_svn_revision ;
+}
+
/* temp, for backward compat */
static int init_pool_ptr = 0;
@@ -293,6 +299,7 @@ static struct statistic stats[] = {
{"banner", 'S', (void *) &getbanner},
{"luatex_version", 'G', &get_luatexversion},
{"luatex_revision", 'S', (void *) &luatexrevision},
+ {"development_id", 'N', &get_development_id},
{"luatex_hashtype", 'S', (void *) &get_luatexhashtype},
{"luatex_hashchars", 'N', &get_luatexhashchars},
{"luatex_engine", 'S', (void *) &getenginename},
@@ -471,9 +478,15 @@ static int resetmessages(lua_State * L)
return 0;
}
+static int setexitcode(lua_State * L) {
+ defaultexitcode = luaL_checkinteger(L,1);
+ return 0;
+}
+
static const struct luaL_Reg statslib[] = {
{"list", statslist},
{"resetmessages", resetmessages},
+ {"setexitcode", setexitcode},
{NULL, NULL} /* sentinel */
};
diff --git a/Build/source/texk/web2c/luatexdir/lua/lstrlibext.c b/Build/source/texk/web2c/luatexdir/lua/lstrlibext.c
index 5d5c0d723ac..f7f8cbf10ea 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lstrlibext.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lstrlibext.c
@@ -359,6 +359,133 @@ static int str_bytetable (lua_State *L) {
return 1;
}
+/*
+ We provide a few helpers that we derived from the lua utf8 module
+ and slunicode. That way we're sort of covering a decent mix.
+
+*/
+
+#define MAXUNICODE 0x10FFFF
+
+/*
+ This is a combination of slunicode and utf8 converters but without mode
+ and a bit faster on the average than the utf8 one.
+*/
+
+static void utf8_enco (luaL_Buffer *b, unsigned c)
+{
+ if (c > MAXUNICODE) {
+ /* we silently ignore the bad character */
+ return;
+ }
+ if (0x80 > c) {
+ luaL_addchar(b, c);
+ return;
+ }
+ if (0x800 > c)
+ luaL_addchar(b, 0xC0|(c>>6));
+ else {
+ if (0x10000 > c)
+ luaL_addchar(b, 0xE0|(c>>12));
+ else {
+ luaL_addchar(b, 0xF0|(c>>18));
+ luaL_addchar(b, 0x80|(0x3F&(c>>12)));
+ }
+ luaL_addchar(b, 0x80|(0x3F&(c>>6)));
+ }
+ luaL_addchar(b, 0x80|(0x3F&c));
+}
+
+static int str_character (lua_State *L) {
+ int n = lua_gettop(L); /* number of arguments */
+ int i;
+ luaL_Buffer b;
+ luaL_buffinit(L,&b);
+ for (i = 1; i <= n; i++) {
+ utf8_enco (&b, (unsigned) lua_tointeger(L, i));
+ }
+ luaL_pushresult(&b);
+ return 1;
+}
+
+/*
+ The utf8 codepoint function takes two arguments, being positions in the
+ string, while slunicode byte takes two arguments representing the number of
+ utf characters. The variant below always returns all codepoints.
+
+*/
+
+static int str_utfvalue (lua_State *L) {
+ size_t ls;
+ int ind = 0;
+ int num = 0;
+ const char *s = lua_tolstring(L, 1, &ls);
+ while (ind<(int)ls) {
+ unsigned char i = (unsigned)*(s+ind);
+ if (i<0x80) {
+ lua_pushinteger(L, i);
+ num += 1;
+ ind += 1;
+ } else if (i>=0xF0) {
+ if ((ind+3)<(int)ls && ((unsigned)*(s+ind+1))>=0x80 && ((unsigned)*(s+ind+2))>=0x80 && ((unsigned)*(s+ind+3))>=0x80) {
+ unsigned char j = ((unsigned)*(s+ind+1))-128;
+ unsigned char k = ((unsigned)*(s+ind+2))-128;
+ unsigned char l = ((unsigned)*(s+ind+3))-128;
+ lua_pushinteger(L, (((((i-0xF0)*64) + j)*64) + k)*64 + l);
+ num += 1;
+ }
+ ind += 4;
+ } else if (i>=0xE0) {
+ if ((ind+2)<(int)ls && ((unsigned)*(s+ind+1))>=0x80 && ((unsigned)*(s+ind+2))>=0x80) {
+ unsigned char j = ((unsigned)*(s+ind+1))-128;
+ unsigned char k = ((unsigned)*(s+ind+2))-128;
+ lua_pushinteger(L, (((i-0xE0)*64) + j)*64 + k);
+ num += 1;
+ }
+ ind += 3;
+ } else if (i>=0xC0) {
+ if ((ind+1)<(int)ls && ((unsigned)*(s+ind+1))>=0x80) {
+ unsigned char j = ((unsigned)*(s+ind+1))-128;
+ lua_pushinteger(L, ((i-0xC0)*64) + j);
+ num += 1;
+ }
+ ind += 2;
+ } else {
+ ind += 1;
+ }
+ }
+ return num;
+}
+
+/* This is a simplified version of utf8.len but without range. */
+
+static int str_utflength (lua_State *L) {
+ size_t ls;
+ int ind = 0;
+ int num = 0;
+ const char *s = lua_tolstring(L, 1, &ls);
+ while (ind<(int)ls) {
+ unsigned char i = (unsigned)*(s+ind);
+ if (i<0x80) {
+ ind += 1;
+ } else if (i>=0xF0) {
+ ind += 4;
+ } else if (i>=0xE0) {
+ ind += 3;
+ } else if (i>=0xC0) {
+ ind += 2;
+ } else {
+ /* bad news, stupid recovery */
+ ind += 1;
+ }
+ num += 1;
+ }
+ lua_pushinteger(L, num);
+ return 1;
+}
+
+/* end of convenience inclusion */
+
static const luaL_Reg strlibext[] = {
{"utfvalues", str_utfvalues},
{"utfcharacters", str_utfcharacters},
@@ -368,6 +495,9 @@ static const luaL_Reg strlibext[] = {
{"bytepairs", str_bytepairs},
{"bytetable", str_bytetable},
{"explode", str_split},
+ {"utfcharacter", str_character},
+ {"utfvalue", str_utfvalue},
+ {"utflength", str_utflength},
#ifdef LuajitTeX
/* luajit has dump built in */
#else
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
index b5a110657f4..65e55705e44 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
@@ -789,7 +789,7 @@ static int get_item_index(lua_State * L, int i, int base)
static int gettex(lua_State * L);
-#define get_item_index_plus(L, where, base, what, value, is_assign, get_register, glue) { \
+#define get_item_index_plus(L, where, base, what, value, is_assign, get_register, texget) { \
size_t len; \
const char *str; \
int key, cs; \
@@ -804,7 +804,7 @@ static int gettex(lua_State * L);
if (key >= 0 && key <= 65535) { \
value = get_register(key); \
} else if (is_assign(eq_type(cs))) { \
- gettex(L); /* lazy */ \
+ texget = gettex(L); /* lazy */ \
} else { \
luaL_error(L, "incorrect %s name", what); \
} \
@@ -849,7 +849,11 @@ static int setdimen(lua_State * L)
static int getdimen(lua_State * L)
{
int value = 0;
- get_item_index_plus(L, lua_gettop(L), scaled_base, "dimen", value, is_dim_assign, get_tex_dimen_register, false);
+ int texget = 0;
+ get_item_index_plus(L, lua_gettop(L), scaled_base, "dimen", value, is_dim_assign, get_tex_dimen_register, texget);
+ if (texget > 0) {
+ return texget;
+ }
lua_pushinteger(L, value);
return 1;
}
@@ -877,7 +881,11 @@ static int setskip(lua_State * L)
static int getskip(lua_State * L)
{
int value = 0;
- get_item_index_plus(L, lua_gettop(L), skip_base, "skip", value, is_glue_assign, get_tex_skip_register, true);
+ int texget = 0;
+ get_item_index_plus(L, lua_gettop(L), skip_base, "skip", value, is_glue_assign, get_tex_skip_register, texget);
+ if (texget > 0) {
+ return texget;
+ }
if (value == null) {
lua_nodelib_push_fast(L, copy_node(zero_glue));
} else {
@@ -910,22 +918,47 @@ static int setglue(lua_State * L)
static int getglue(lua_State * L)
{
int value = 0;
+ int texget = 0;
int top = lua_gettop(L);
- get_item_index_plus(L, top, skip_base, "skip", value, is_glue_assign, get_tex_skip_register, true);
- if (value == null) {
- lua_pushinteger(L,0);
- lua_pushinteger(L,0);
- lua_pushinteger(L,0);
- lua_pushinteger(L,0);
- lua_pushinteger(L,0);
+ int dim = -1;
+ if (top > 1 && lua_type(L,top) == LUA_TBOOLEAN) {
+ dim = lua_toboolean(L,top);
+ top = top - 1;
} else {
- lua_pushinteger(L,width(value));
- lua_pushinteger(L,stretch(value));
- lua_pushinteger(L,shrink(value));
- lua_pushinteger(L,stretch_order(value));
- lua_pushinteger(L,shrink_order(value));
+ lua_pushboolean(L,1);
+ dim = 1 ;
+ /* no top adaption. somewhat messy, but the gettex fallback checks itself */
+ }
+ /* checks itself for the boolean */
+ get_item_index_plus(L, top, skip_base, "glue", value, is_glue_assign, get_tex_skip_register, texget);
+ if (texget > 0) {
+ return texget;
+ }
+ if (dim == 0) {
+ /* false */
+ if (value == null) {
+ lua_pushinteger(L,0);
+ } else {
+ lua_pushinteger(L,width(value));
+ }
+ return 1;
+ } else {
+ /* true and nil */
+ if (value == null) {
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ } else {
+ lua_pushinteger(L,width(value));
+ lua_pushinteger(L,stretch(value));
+ lua_pushinteger(L,shrink(value));
+ lua_pushinteger(L,stretch_order(value));
+ lua_pushinteger(L,shrink_order(value));
+ }
+ return 5;
}
- return 5;
}
static int ismuskip(lua_State * L)
@@ -947,7 +980,11 @@ static int setmuskip(lua_State * L)
static int getmuskip(lua_State * L)
{
int value = 0;
- get_item_index_plus(L, lua_gettop(L), mu_skip_base, "muskip", value, is_mu_glue_assign, get_tex_mu_skip_register, true);
+ int texget = 0;
+ get_item_index_plus(L, lua_gettop(L), mu_skip_base, "muskip", value, is_mu_glue_assign, get_tex_mu_skip_register, texget);
+ if (texget > 0) {
+ return texget;
+ }
lua_nodelib_push_fast(L, copy_node(value));
return 1;
}
@@ -976,16 +1013,45 @@ static int setmuglue(lua_State * L)
static int getmuglue(lua_State * L)
{
int value = 0;
- get_item_index_plus(L, lua_gettop(L), mu_skip_base, "muskip", value, is_mu_glue_assign, get_tex_mu_skip_register, true);
- if (value == null) {
- lua_pushnil(L);
- return 1;
+ int texget = 0;
+ int top = lua_gettop(L);
+ int dim = -1;
+ if (top > 1 && lua_type(L,top) == LUA_TBOOLEAN) {
+ dim = lua_toboolean(L,top);
+ top = top - 1;
} else {
- lua_pushinteger(L,width(value));
- lua_pushinteger(L,stretch(value));
- lua_pushinteger(L,shrink(value));
- lua_pushinteger(L,stretch_order(value));
- lua_pushinteger(L,shrink_order(value));
+ lua_pushboolean(L,1);
+ dim = 1 ;
+ /* no top adaption. somewhat messy, but the gettex fallback checks itself */
+ }
+ /* checks itself for the boolean */
+ get_item_index_plus(L, top, mu_skip_base, "muskip", value, is_mu_glue_assign, get_tex_mu_skip_register, texget);
+ if (texget > 0) {
+ return texget;
+ }
+ if (dim == 0) {
+ /* false */
+ if (value == null) {
+ lua_pushinteger(L,0);
+ } else {
+ lua_pushinteger(L,width(value));
+ }
+ return 1;
+ } else {
+ /* true and nil */
+ if (value == null) {
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ lua_pushinteger(L,0);
+ } else {
+ lua_pushinteger(L,width(value));
+ lua_pushinteger(L,stretch(value));
+ lua_pushinteger(L,shrink(value));
+ lua_pushinteger(L,stretch_order(value));
+ lua_pushinteger(L,shrink_order(value));
+ }
return 5;
}
}
@@ -1015,7 +1081,11 @@ static int setcount(lua_State * L)
static int getcount(lua_State * L)
{
int value = 0;
- get_item_index_plus(L, lua_gettop(L), count_base, "count", value, is_int_assign, get_tex_count_register, false);
+ int texget = 0;
+ get_item_index_plus(L, lua_gettop(L), count_base, "count", value, is_int_assign, get_tex_count_register, texget);
+ if (texget > 0) {
+ return texget;
+ }
lua_pushinteger(L, value);
return 1;
}
@@ -1047,7 +1117,11 @@ static int setattribute(lua_State * L)
static int getattribute(lua_State * L)
{
int value = 0;
- get_item_index_plus(L, lua_gettop(L), attribute_base, "attribute", value, is_attr_assign, get_tex_attribute_register, false);
+ int texget = 0;
+ get_item_index_plus(L, lua_gettop(L), attribute_base, "attribute", value, is_attr_assign, get_tex_attribute_register, texget);
+ if (texget > 0) {
+ return texget;
+ }
lua_pushinteger(L, value);
return 1;
}
@@ -2278,7 +2352,7 @@ static const struct luaL_Reg nest_m[] = {
static void init_nest_lib(lua_State * L)
{
luaL_newmetatable(L, NEST_METATABLE);
- luaL_register(L, NULL, nest_m);
+ luaL_openlib(L, NULL, nest_m, 0);
lua_pop(L, 1);
}
@@ -2656,7 +2730,7 @@ static int tex_enableprimitives(lua_State * L)
#define get_dimen_par(A,B) do { \
lua_key_rawgeti(A); \
if (lua_type(L, -1) == LUA_TNUMBER) { \
- A = (int) lua_tointeger(L, -1); \
+ A = (int) lua_roundnumber(L, -1); \
} else { \
A = (B); \
} \
@@ -2937,11 +3011,12 @@ static int tex_run_boot(lua_State * L)
/* Initialize synctex primitive */
synctexinitcommand();
/* tex is ready to go, now */
+ /*
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, "node", node_table_id);
-
+ */
lua_pushboolean(L, 1); /* true */
return 1;
}
@@ -3040,6 +3115,7 @@ static int tex_save_box_resource(lua_State * L)
int attributes = null;
int resources = null;
int type = 0;
+ int margin = pdf_xform_margin;
boolean immediate = false;
/* box attributes resources */
halfword boxnumber = lua_tointeger(L,1);
@@ -3057,6 +3133,9 @@ static int tex_save_box_resource(lua_State * L)
if (lua_type(L,5) == LUA_TNUMBER) {
type = lua_tointeger(L, 5);
}
+ if (lua_type(L,6) == LUA_TNUMBER) {
+ margin = lua_tointeger(L, 6);
+ }
/* more or less same as scanner variant */
boxdata = box(boxnumber);
if (boxdata == null)
@@ -3073,6 +3152,7 @@ static int tex_save_box_resource(lua_State * L)
set_obj_xform_height(static_pdf, index, height(boxdata));
set_obj_xform_depth(static_pdf, index, depth(boxdata));
set_obj_xform_type(static_pdf, index, type);
+ set_obj_xform_margin(static_pdf, index, margin);
box(boxnumber) = null;
last_saved_box_index = index;
lua_pushinteger(L, index);
@@ -3137,14 +3217,16 @@ static int tex_get_box_resource_dimensions(lua_State * L)
lua_pushnil(L);
lua_pushnil(L);
lua_pushnil(L);
+ lua_pushnil(L);
} else {
index = lua_tointeger(L,1);
check_obj_type(static_pdf, obj_type_xform, index);
lua_pushinteger(L, (int) obj_xform_width(static_pdf, index));
lua_pushinteger(L, (int) obj_xform_height(static_pdf, index));
lua_pushinteger(L, (int) obj_xform_depth(static_pdf, index));
+ lua_pushinteger(L, (int) obj_xform_margin(static_pdf, index));
}
- return 3;
+ return 4;
}
static int tex_build_page(lua_State * L)
@@ -3153,6 +3235,69 @@ static int tex_build_page(lua_State * L)
return 0;
}
+/* synctex */
+
+static int lua_set_synctex_mode(lua_State * L)
+{
+ halfword mode = lua_tointeger(L, 1);
+ synctex_set_mode(mode);
+ return 0;
+}
+static int lua_get_synctex_mode(lua_State * L)
+{
+ lua_pushinteger(L,synctex_get_mode());
+ return 1;
+}
+
+static int lua_set_synctex_tag(lua_State * L)
+{
+ halfword tag = lua_tointeger(L, 1);
+ synctex_set_tag(tag);
+ return 0;
+}
+
+static int lua_get_synctex_tag(lua_State * L)
+{
+ lua_pushinteger(L,synctex_get_tag());
+ return 1;
+}
+
+static int lua_force_synctex_tag(lua_State * L)
+{
+ halfword tag = lua_tointeger(L, 1);
+ synctex_force_tag(tag);
+ return 0;
+}
+
+static int lua_force_synctex_line(lua_State * L)
+{
+ halfword line = lua_tointeger(L, 1);
+ synctex_force_line(line);
+ return 0;
+}
+
+static int lua_set_synctex_line(lua_State * L)
+{
+ halfword line = lua_tointeger(L, 1);
+ synctex_set_line(line);
+ return 0;
+}
+
+static int lua_get_synctex_line(lua_State * L)
+{
+ lua_pushinteger(L,synctex_get_line());
+ return 1;
+}
+
+static int lua_set_synctex_no_files(lua_State * L)
+{
+ halfword flag = lua_tointeger(L, 1);
+ synctex_set_no_files(flag);
+ return 0;
+}
+
+/* till here */
+
void init_tex_table(lua_State * L)
{
lua_createtable(L, 0, 3);
@@ -3252,13 +3397,23 @@ static const struct luaL_Reg texlib[] = {
{ "getboxresourcedimensions", tex_get_box_resource_dimensions },
/* just for testing: it will probably stay but maybe with options */
{ "triggerbuildpage", tex_build_page },
+ /* not the best place but better than in node */
+ { "set_synctex_mode", lua_set_synctex_mode },
+ { "get_synctex_mode", lua_get_synctex_mode },
+ { "set_synctex_tag", lua_set_synctex_tag },
+ { "get_synctex_tag", lua_get_synctex_tag },
+ { "set_synctex_no_files", lua_set_synctex_no_files },
+ { "force_synctex_tag", lua_force_synctex_tag },
+ { "force_synctex_line", lua_force_synctex_line },
+ { "set_synctex_line", lua_set_synctex_line },
+ { "get_synctex_line", lua_get_synctex_line },
/* sentinel */
{ NULL, NULL }
};
int luaopen_tex(lua_State * L)
{
- luaL_register(L, "tex", texlib);
+ luaL_openlib(L, "tex", texlib, 0);
/* *INDENT-OFF* */
make_table(L, "attribute", "tex.attribute", "getattribute", "setattribute");
make_table(L, "skip", "tex.skip", "getskip", "setskip");
diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w
index fa43976b0ac..763ac1a42a5 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luainit.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w
@@ -446,7 +446,7 @@ static void parse_options(int ac, char **av)
"kpathsea : Karl Berry, Olaf Weber and others\n"
"lua : Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo\n"
"metapost : John Hobby, Taco Hoekwater and friends\n"
- "poppler : Derek Noonburg, Kristian H\\ogsberg (partial)\n"
+ "poppler : Derek Noonburg, Kristian Hogsberg (partial)\n"
"fontforge : George Williams (partial)\n"
"luajit : Mike Pall (used in LuajitTeX)\n");
/* *INDENT-ON* */
@@ -767,10 +767,12 @@ static void setup_lua_path(lua_State * L)
@ helper variables for the safe keeping of table ids
@c
+/*
int tex_table_id;
int pdf_table_id;
int token_table_id;
int node_table_id;
+*/
@ @c
int l_pack_type_index [PACK_TYPE_SIZE] ;
@@ -941,8 +943,8 @@ void lua_initialize(int ac, char **av)
/* If setlocale fails here, then the state */
/* could be compromised, and we exit. */
env_locale = setlocale (LC_ALL, "");
- if (!env_locale) {
- fprintf(stderr,"Unable to read environment locale:exit now.\n");
+ if (!env_locale && !lua_only) {
+ fprintf(stderr,"Unable to read environment locale: exit now.\n");
exit(1);
}
tmp = setlocale (LC_CTYPE, NULL);
@@ -962,7 +964,7 @@ void lua_initialize(int ac, char **av)
/* we can't ensure a 'sane' locale for lua. */
env_locale = setlocale (LC_ALL, old_locale);
if (!env_locale) {
- fprintf(stderr,"Unable to restore original locale:exit now.\n");
+ fprintf(stderr,"Unable to restore original locale %s: exit now.\n",old_locale);
exit(1);
}
xfree(old_locale);
@@ -1011,47 +1013,53 @@ void lua_initialize(int ac, char **av)
/* now run the file */
if (startup_filename != NULL) {
char *v1;
- /* hide the 'tex' and 'pdf' table */
- tex_table_id = hide_lua_table(Luas, "tex");
- token_table_id = hide_lua_table(Luas, "token");
- node_table_id = hide_lua_table(Luas, "node");
- pdf_table_id = hide_lua_table(Luas, "pdf");
-
+ int tex_table_id = hide_lua_table(Luas, "tex");
+ int token_table_id = hide_lua_table(Luas, "token");
+ int node_table_id = hide_lua_table(Luas, "node");
+ int pdf_table_id = hide_lua_table(Luas, "pdf");
+ if (lua_only) {
+ /* hide the 'tex' and 'pdf' table */
+ if (load_luatex_core_lua(Luas)) {
+ fprintf(stderr, "Error in execution of luatex-core.lua .\n");
+ }
+ if (luaL_loadfile(Luas, startup_filename)) {
+ fprintf(stdout, "%s\n", lua_tostring(Luas, -1));
+ exit(1);
+ }
+ init_tex_table(Luas); /* needed ? */
+ if (lua_pcall(Luas, 0, 0, 0)) {
+ fprintf(stdout, "%s\n", lua_tostring(Luas, -1));
+ lua_traceback(Luas);
+ /* lua_close(Luas); */
+ exit(1);
+ } else {
+ if (given_file)
+ free(given_file);
+ /* lua_close(Luas); */
+ exit(0);
+ }
+ }
+ /* a normal tex run */
+ init_tex_table(Luas);
+ 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, "node", node_table_id);
if (luaL_loadfile(Luas, startup_filename)) {
fprintf(stdout, "%s\n", lua_tostring(Luas, -1));
exit(1);
}
- /* */
- init_tex_table(Luas);
- if (lua_only) {
- if (load_luatex_core_lua(Luas))
- fprintf(stderr, "Error in execution of luatex-core.lua .\n");
- }
if (lua_pcall(Luas, 0, 0, 0)) {
fprintf(stdout, "%s\n", lua_tostring(Luas, -1));
- lua_traceback(Luas);
+ lua_traceback(Luas);
exit(1);
}
- /* no filename? quit now! */
if (!input_name) {
get_lua_string("texconfig", "jobname", &input_name);
}
if (!dump_name) {
get_lua_string("texconfig", "formatname", &dump_name);
}
- if (lua_only) {
- if (given_file)
- free(given_file);
- /* this is not strictly needed but it pleases valgrind */
- lua_close(Luas);
- exit(0);
- }
- /* unhide the 'tex' and 'pdf' table */
- 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, "node", node_table_id);
-
/* |kpse_init| */
kpse_init = -1;
get_lua_boolean("texconfig", "kpse_init", &kpse_init);
diff --git a/Build/source/texk/web2c/luatexdir/lua/luanode.w b/Build/source/texk/web2c/luatexdir/lua/luanode.w
index af15748bacd..c09cac1ff01 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luanode.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luanode.w
@@ -96,21 +96,18 @@ void lua_node_filter(int filterid, int extrainfo, halfword head_node, halfword *
start_node = vlink(head_node);
if (start_node != null) {
/* maybe just always slide (harmless and fast) */
- last_node = vlink(start_node);
if (fix_node_lists) {
- while (last_node != null) {
- alink(last_node) = start_node;
- start_node = last_node;
- last_node = vlink(start_node);
- }
+ /* slides and returns last node */
+ *tail_node = fix_node_list(start_node);
} else {
+ last_node = vlink(start_node);
while (last_node != null) {
start_node = last_node;
last_node = vlink(start_node);
}
+ /* we're at the end now */
+ *tail_node = start_node;
}
- /* we're at the end now */
- *tail_node = start_node;
} else {
/* we're already at the end */
*tail_node = head_node;
diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.w b/Build/source/texk/web2c/luatexdir/lua/luastuff.w
index 6f57e8ee845..7274a683637 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luastuff.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.w
@@ -619,34 +619,6 @@ void preset_environment(lua_State * L, const parm_struct * p, const char *s)
luajit compatibility layer for luatex lua5.2
*/
#ifdef LuajitTeX
-LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) {
- void *p = lua_touserdata(L, ud);
- if (p != NULL) { /* value is a userdata? */
- if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
- luaL_getmetatable(L, tname); /* get correct metatable */
- if (!lua_rawequal(L, -1, -2)) /* not the same? */
- p = NULL; /* value is a userdata with wrong metatable */
- lua_pop(L, 2); /* remove both metatables */
- return p;
- }
- }
- return NULL; /* value is not a userdata with a metatable */
-}
-
-@ @c
-/* It's not ok. See lua-users.org/wiki/CompatibilityWithLuaFive for another solution */
-LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
- /*luaL_checkversion(L);*/
- luaL_checkstack(L, nup, "too many upvalues");
- for (; l->name != NULL; l++) { /* fill the table with given functions */
- int i;
- for (i = 0; i < nup; i++) /* copy upvalues to the top */
- lua_pushvalue(L, -nup);
- lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
- lua_setfield(L, -(nup + 2), l->name);
- }
- lua_pop(L, nup); /* remove upvalues */
-}
@ @c
LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) {
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index b83745049c8..36b2f5979e1 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
@@ -130,6 +130,7 @@ extern int luaopen_font(lua_State * L);
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 characters_from_lua(lua_State * L, int f); /* return is boolean */
extern int luaopen_token(lua_State * L);
extern void tokenlist_to_lua(lua_State * L, int p);
@@ -224,10 +225,13 @@ extern int loader_Call_luatex(lua_State * L, const char *name, const char *filen
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 node_table_id;
+*/
+
extern int main_initialize(void);
extern int do_run_callback(int special, const char *values, va_list vl);
@@ -503,7 +507,6 @@ make_lua_key(area);\
make_lua_key(art);\
make_lua_key(attr);\
make_lua_key(attributes);\
-make_lua_key(auto_expand);\
make_lua_key(bbox);\
make_lua_key(before_display);\
make_lua_key(best_ins_ptr);\
@@ -715,6 +718,7 @@ make_lua_key(pagesattributes);\
make_lua_key(parameters);\
make_lua_key(pardir);\
make_lua_key(parshape);\
+make_lua_key(pdf);\
make_lua_key(pdf_data);\
make_lua_key(pdf_destination);\
make_lua_key(pdf_literal);\
@@ -875,7 +879,6 @@ init_lua_key(area);\
init_lua_key(art);\
init_lua_key(attr);\
init_lua_key(attributes);\
-init_lua_key(auto_expand);\
init_lua_key(bbox);\
init_lua_key(before_display);\
init_lua_key(best_ins_ptr);\
@@ -1220,6 +1223,7 @@ init_lua_key_alias(pLTL,"+LTL");\
init_lua_key_alias(pRTT,"+RTT");\
init_lua_key_alias(pTLT,"+TLT");\
init_lua_key_alias(pTRT,"+TRT");\
+init_lua_key_alias(pdf,"pdf");\
init_lua_key_alias(pdf_data,"pdf.data");\
init_lua_key_alias(term_and_log,"term and log")
@@ -1294,7 +1298,6 @@ use_lua_key(area);
use_lua_key(art);
use_lua_key(attr);
use_lua_key(attributes);
-use_lua_key(auto_expand);
use_lua_key(bbox);
use_lua_key(before_display);
use_lua_key(best_ins_ptr);
@@ -1506,6 +1509,7 @@ use_lua_key(pagesattributes);
use_lua_key(parameters);
use_lua_key(pardir);
use_lua_key(parshape);
+use_lua_key(pdf);
use_lua_key(pdf_data);
use_lua_key(pdf_destination);
use_lua_key(pdf_literal);
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-core.c b/Build/source/texk/web2c/luatexdir/lua/luatex-core.c
index 631f25c3b99..780c12f4c50 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-core.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-core.c
@@ -24,7 +24,7 @@ int load_luatex_core_lua (lua_State * L)
0x54, 0x65, 0x58, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x20,
0x54, 0x65, 0x61, 0x6d, 0x27, 0x2c, 0x0a, 0x2d, 0x2d, 0x20, 0x7d, 0x0a, 0x0a, 0x4c, 0x55, 0x41,
0x54, 0x45, 0x58, 0x43, 0x4f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x20, 0x3d,
- 0x20, 0x31, 0x2e, 0x30, 0x30, 0x32, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20,
+ 0x20, 0x31, 0x2e, 0x30, 0x30, 0x33, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20,
0x66, 0x69, 0x6c, 0x65, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x20, 0x73,
0x6f, 0x6d, 0x65, 0x20, 0x4c, 0x75, 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x20,
@@ -45,214 +45,260 @@ int load_luatex_core_lua (lua_State * L)
0x65, 0x20, 0x3d, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2c, 0x20, 0x6e, 0x65, 0x78, 0x74, 0x2c, 0x20,
0x67, 0x65, 0x74, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2c, 0x20, 0x72, 0x65,
0x71, 0x75, 0x69, 0x72, 0x65, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x6e, 0x64,
- 0x2c, 0x20, 0x67, 0x73, 0x75, 0x62, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e,
- 0x66, 0x69, 0x6e, 0x64, 0x2c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x67, 0x73, 0x75,
- 0x62, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69,
- 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x69, 0x6f, 0x5f,
- 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x2e, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x0a, 0x6c, 0x6f, 0x63, 0x61,
- 0x6c, 0x20, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x73,
- 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64,
- 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x66, 0x69,
- 0x6f, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73,
- 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b,
- 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x66, 0x69, 0x6c, 0x65, 0x6e,
- 0x61, 0x6d, 0x65, 0x20, 0x20, 0x3d, 0x20, 0x66, 0x69, 0x6f, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72,
- 0x64, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x20, 0x6d, 0x74, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x67, 0x65, 0x74, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x61,
- 0x62, 0x6c, 0x65, 0x28, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x29, 0x0a, 0x6c,
- 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6d, 0x74, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6d, 0x74, 0x2e, 0x6c, 0x69,
- 0x6e, 0x65, 0x73, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x61, 0x66, 0x65, 0x72, 0x6f,
- 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20,
- 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x73, 0x61, 0x66, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x74,
- 0x69, 0x6f, 0x6e, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x65,
- 0x73, 0x63, 0x61, 0x70, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20,
- 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x65, 0x73, 0x63,
- 0x61, 0x70, 0x65, 0x20, 0x2d, 0x2d, 0x20, 0x30, 0x20, 0x28, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c,
- 0x65, 0x64, 0x29, 0x20, 0x31, 0x20, 0x28, 0x61, 0x6e, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x29,
- 0x20, 0x32, 0x20, 0x28, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x64, 0x29, 0x0a,
- 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6b, 0x70, 0x73, 0x65, 0x75, 0x73, 0x65, 0x64, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x61, 0x74,
- 0x75, 0x73, 0x2e, 0x6b, 0x70, 0x73, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x20, 0x20, 0x20, 0x20,
- 0x2d, 0x2d, 0x20, 0x30, 0x20, 0x31, 0x0a, 0x0a, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x76, 0x65, 0x64,
- 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x2d, 0x2d, 0x20,
- 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64,
- 0x0a, 0x2d, 0x2d, 0x20, 0x28, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72,
- 0x20, 0x74, 0x6c, 0x31, 0x37, 0x20, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x29, 0x20, 0x69,
- 0x6f, 0x2e, 0x73, 0x61, 0x76, 0x65, 0x64, 0x5f, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x5f, 0x70, 0x6f,
- 0x70, 0x65, 0x6e, 0x20, 0x2d, 0x2d, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72,
- 0x6f, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x0a, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x76, 0x65, 0x64,
- 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x2d, 0x2d, 0x20,
- 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x0a,
- 0x6d, 0x74, 0x2e, 0x73, 0x61, 0x76, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6d, 0x74, 0x5f, 0x6c,
- 0x69, 0x6e, 0x65, 0x73, 0x20, 0x2d, 0x2d, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x72,
- 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66,
- 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69,
- 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x6f, 0x77, 0x20,
- 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x6f, 0x77,
- 0x20, 0x3d, 0x20, 0x27, 0x72, 0x27, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20,
- 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x5f,
- 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29, 0x0a, 0x20,
+ 0x2c, 0x20, 0x67, 0x73, 0x75, 0x62, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x3d,
+ 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x66, 0x69, 0x6e, 0x64, 0x2c, 0x20, 0x73, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x67, 0x73, 0x75, 0x62, 0x2c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e,
+ 0x67, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20,
+ 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x0a, 0x6c, 0x6f,
+ 0x63, 0x61, 0x6c, 0x20, 0x69, 0x6f, 0x5f, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x2e, 0x70, 0x6f, 0x70,
+ 0x65, 0x6e, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65,
+ 0x73, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69,
+ 0x6f, 0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66,
+ 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x3d, 0x20, 0x66, 0x69, 0x6f, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e,
+ 0x65, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x63, 0x68, 0x65, 0x63,
+ 0x6b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x69,
+ 0x6f, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x63, 0x6f,
+ 0x72, 0x64, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x20, 0x3d, 0x20, 0x66, 0x69,
+ 0x6f, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65,
+ 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6d, 0x74, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x67, 0x65,
+ 0x74, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x28, 0x69, 0x6f, 0x2e, 0x73, 0x74,
+ 0x64, 0x65, 0x72, 0x72, 0x29, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6d, 0x74, 0x5f, 0x6c,
+ 0x69, 0x6e, 0x65, 0x73, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x3d, 0x20, 0x6d, 0x74, 0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x20, 0x73, 0x61, 0x66, 0x65, 0x72, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x73, 0x61,
+ 0x66, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x20, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x73, 0x68,
+ 0x65, 0x6c, 0x6c, 0x5f, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x20, 0x2d, 0x2d, 0x20, 0x30, 0x20,
+ 0x28, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x29, 0x20, 0x31, 0x20, 0x28, 0x61, 0x6e,
+ 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x29, 0x20, 0x32, 0x20, 0x28, 0x72, 0x65, 0x73, 0x74, 0x72,
+ 0x69, 0x63, 0x74, 0x65, 0x64, 0x29, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6b, 0x70, 0x73,
+ 0x65, 0x75, 0x73, 0x65, 0x64, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x3d, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x6b, 0x70, 0x73, 0x65, 0x5f, 0x75,
+ 0x73, 0x65, 0x64, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x20, 0x30, 0x20, 0x31, 0x0a, 0x0a, 0x6c,
+ 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6e, 0x6c, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x69, 0x6f,
+ 0x2e, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6e, 0x6c, 0x0a, 0x0a, 0x69, 0x6f, 0x2e, 0x73, 0x61,
+ 0x76, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20,
+ 0x2d, 0x2d, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e,
+ 0x6c, 0x79, 0x0a, 0x6d, 0x74, 0x2e, 0x73, 0x61, 0x76, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, 0x65,
+ 0x73, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6d,
+ 0x74, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x2d, 0x2d, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79,
+ 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61,
+ 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65,
+ 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68,
+ 0x6f, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68,
+ 0x6f, 0x77, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x68, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x27, 0x72, 0x27, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
+ 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20,
+ 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77,
+ 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28,
+ 0x68, 0x6f, 0x77, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x27,
+ 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x69, 0x6e, 0x64, 0x28, 0x68, 0x6f, 0x77, 0x2c, 0x27, 0x77,
+ 0x27, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x66, 0x69,
+ 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x27, 0x77, 0x27, 0x29,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65,
+ 0x63, 0x6f, 0x72, 0x64, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x6e, 0x61, 0x6d,
+ 0x65, 0x2c, 0x27, 0x72, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65,
+ 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72,
+ 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x6c, 0x6f, 0x63,
+ 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74,
+ 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f,
+ 0x6e, 0x6c, 0x79, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x69, 0x66, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x27, 0x72, 0x27, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x68, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x67, 0x73, 0x75, 0x62, 0x28, 0x68, 0x6f, 0x77, 0x2c,
+ 0x27, 0x5b, 0x5e, 0x72, 0x62, 0x5d, 0x27, 0x2c, 0x27, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x27,
+ 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x27, 0x72, 0x27, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20, 0x69, 0x6f,
+ 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64,
+ 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x27, 0x72,
+ 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72,
+ 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x6c, 0x6f, 0x63,
+ 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74,
+ 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65,
+ 0x2c, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20,
+ 0x6f, 0x6b, 0x61, 0x79, 0x2c, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x69,
+ 0x6f, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6f,
+ 0x6b, 0x61, 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x74, 0x68,
+ 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
+ 0x6e, 0x20, 0x69, 0x6f, 0x5f, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x66, 0x6f, 0x75, 0x6e, 0x64,
+ 0x2c, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e,
+ 0x64, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
+ 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65,
+ 0x73, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x69, 0x66, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20, 0x69,
+ 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x20,
+ 0x6f, 0x72, 0x20, 0x27, 0x72, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x69, 0x66, 0x20, 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66,
+ 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x28, 0x66, 0x29, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65,
+ 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75,
+ 0x72, 0x6e, 0x20, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x28, 0x29, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78,
+ 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x28, 0x66, 0x29, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74,
+ 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
+ 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e,
+ 0x65, 0x28, 0x66, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64,
+ 0x0a, 0x0a, 0x69, 0x6f, 0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61,
+ 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x0a, 0x6d, 0x74, 0x2e,
+ 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69,
+ 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x57,
+ 0x65, 0x20, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d,
+ 0x65, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64,
+ 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63,
+ 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x6b, 0x70, 0x73, 0x65, 0x2e, 0x20, 0x54,
+ 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x63, 0x61,
+ 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x43, 0x6f, 0x6e, 0x54, 0x65, 0x58, 0x74, 0x2e, 0x0a, 0x0a,
+ 0x69, 0x66, 0x20, 0x6b, 0x70, 0x73, 0x65, 0x75, 0x73, 0x65, 0x64, 0x20, 0x3d, 0x3d, 0x20, 0x31,
+ 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x20, 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f,
+ 0x6f, 0x70, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x70, 0x6f, 0x70, 0x65,
+ 0x6e, 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x70, 0x6f,
+ 0x70, 0x65, 0x6e, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x69, 0x66, 0x20, 0x73, 0x61, 0x66,
+ 0x65, 0x72, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x20, 0x74, 0x68,
+ 0x65, 0x6e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75,
+ 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75,
+ 0x6d, 0x6d, 0x79, 0x28, 0x73, 0x74, 0x72, 0x2c, 0x66, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65,
+ 0x64, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
+ 0x6e, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74,
+ 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6e, 0x6c,
+ 0x28, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x28, 0x22, 0x73, 0x61, 0x66, 0x65, 0x72, 0x20, 0x6f,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x65, 0x74, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74,
+ 0x69, 0x6f, 0x6e, 0x20, 0x25, 0x71, 0x20, 0x69, 0x73, 0x20, 0x25, 0x73, 0x22, 0x2c, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x2c, 0x66, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x22, 0x6c, 0x69,
+ 0x6d, 0x69, 0x74, 0x65, 0x64, 0x22, 0x20, 0x6f, 0x72, 0x20, 0x22, 0x64, 0x69, 0x73, 0x61, 0x62,
+ 0x6c, 0x65, 0x64, 0x22, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20,
+ 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x68, 0x6f, 0x77,
- 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x27, 0x20, 0x61, 0x6e,
- 0x64, 0x20, 0x66, 0x69, 0x6e, 0x64, 0x28, 0x68, 0x6f, 0x77, 0x2c, 0x27, 0x77, 0x27, 0x29, 0x20,
- 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x66, 0x69, 0x6c, 0x65, 0x6e,
- 0x61, 0x6d, 0x65, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x27, 0x77, 0x27, 0x29, 0x0a, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72,
- 0x64, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x27,
- 0x72, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a,
- 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75,
- 0x72, 0x6e, 0x20, 0x66, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20,
- 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f,
- 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79,
- 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69,
- 0x66, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x27, 0x72, 0x27, 0x0a, 0x20, 0x20, 0x20,
- 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x6f,
- 0x77, 0x20, 0x3d, 0x20, 0x67, 0x73, 0x75, 0x62, 0x28, 0x68, 0x6f, 0x77, 0x2c, 0x27, 0x5b, 0x5e,
- 0x72, 0x62, 0x5d, 0x27, 0x2c, 0x27, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x69, 0x66, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x27, 0x20, 0x74, 0x68,
- 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68,
- 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x27, 0x72, 0x27, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20,
- 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x5f, 0x6f, 0x70,
- 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20,
- 0x20, 0x69, 0x66, 0x20, 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x66, 0x69, 0x6c,
- 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x27, 0x72, 0x27, 0x29, 0x0a,
- 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75,
- 0x72, 0x6e, 0x20, 0x66, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20,
- 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f,
- 0x69, 0x6f, 0x5f, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x2e, 0x2e,
- 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x6b, 0x61,
- 0x79, 0x2c, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x63,
- 0x68, 0x65, 0x63, 0x6b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x28, 0x6e,
- 0x61, 0x6d, 0x65, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6f, 0x6b, 0x61, 0x79,
- 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x69,
- 0x6f, 0x5f, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2c, 0x2e, 0x2e,
- 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a,
- 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c,
- 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x28, 0x6e,
- 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20, 0x69, 0x6f, 0x5f, 0x6f,
- 0x70, 0x65, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x68, 0x6f, 0x77, 0x20, 0x6f, 0x72, 0x20,
- 0x27, 0x72, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20,
- 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
- 0x6f, 0x6e, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x69, 0x6f, 0x5f,
- 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x28, 0x66, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
- 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65,
- 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75,
- 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f,
- 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x28, 0x66, 0x29, 0x0a, 0x20, 0x20, 0x20,
- 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
- 0x6e, 0x20, 0x66, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x28, 0x66,
- 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x69,
- 0x6f, 0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78,
- 0x5f, 0x69, 0x6f, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x0a, 0x6d, 0x74, 0x2e, 0x6c, 0x69, 0x6e,
- 0x65, 0x73, 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72,
- 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x57, 0x65, 0x20, 0x61,
- 0x73, 0x73, 0x75, 0x6d, 0x65, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
- 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20,
- 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65,
- 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x6b, 0x70, 0x73, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73,
- 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2d, 0x2d, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20,
- 0x69, 0x6e, 0x20, 0x43, 0x6f, 0x6e, 0x54, 0x65, 0x58, 0x74, 0x2e, 0x0a, 0x0a, 0x69, 0x66, 0x20,
- 0x6b, 0x70, 0x73, 0x65, 0x75, 0x73, 0x65, 0x64, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x20, 0x74, 0x68,
- 0x65, 0x6e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x20,
- 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65,
- 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x3d,
- 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x70, 0x6f, 0x70, 0x65, 0x6e,
- 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x69, 0x66, 0x20, 0x73, 0x61, 0x66, 0x65, 0x72, 0x6f,
- 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x20,
- 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x73, 0x70, 0x61,
- 0x77, 0x6e, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f,
- 0x73, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a,
- 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x65, 0x6e, 0x76, 0x20, 0x20, 0x3d,
- 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6d, 0x70,
- 0x64, 0x69, 0x72, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69,
- 0x6f, 0x2e, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74,
+ 0x75, 0x72, 0x6e, 0x20, 0x66, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
+ 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x28,
+ 0x73, 0x74, 0x72, 0x2c, 0x66, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c,
+ 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20,
+ 0x66, 0x61, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x20, 0x3d, 0x20,
+ 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6f, 0x73,
+ 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f,
+ 0x73, 0x2e, 0x73, 0x70, 0x61, 0x77, 0x6e, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74,
+ 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6f, 0x73, 0x2e, 0x73, 0x70, 0x61,
+ 0x77, 0x6e, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x65, 0x78, 0x65, 0x63,
+ 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d,
+ 0x6d, 0x79, 0x28, 0x22, 0x6f, 0x73, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x22, 0x29, 0x0a, 0x20, 0x20,
+ 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x65, 0x6e, 0x76, 0x20, 0x20, 0x3d, 0x20, 0x69,
+ 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6f, 0x73, 0x2e,
+ 0x73, 0x65, 0x74, 0x65, 0x6e, 0x76, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e,
+ 0x74, 0x65, 0x6d, 0x70, 0x64, 0x69, 0x72, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c,
+ 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x64,
+ 0x69, 0x72, 0x22, 0x29, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x70, 0x6f, 0x70,
+ 0x65, 0x6e, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75,
+ 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x69, 0x6f, 0x2e, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x22, 0x29, 0x0a,
0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x20, 0x20, 0x3d,
- 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x6e,
- 0x61, 0x6d, 0x65, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f,
- 0x73, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x74, 0x6d, 0x70, 0x66, 0x69, 0x6c, 0x65, 0x20,
- 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x75, 0x74,
- 0x70, 0x75, 0x74, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20,
- 0x6c, 0x66, 0x73, 0x2e, 0x63, 0x68, 0x64, 0x69, 0x72, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x66, 0x73, 0x2e, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x20, 0x20,
- 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x66, 0x73, 0x2e, 0x74, 0x6f,
- 0x75, 0x63, 0x68, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c,
- 0x66, 0x73, 0x2e, 0x72, 0x6d, 0x64, 0x69, 0x72, 0x20, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a,
- 0x20, 0x20, 0x20, 0x20, 0x6c, 0x66, 0x73, 0x2e, 0x6d, 0x6b, 0x64, 0x69, 0x72, 0x20, 0x20, 0x3d,
- 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x76,
- 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x20, 0x3d, 0x20, 0x6c, 0x75, 0x61, 0x74, 0x65,
- 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e,
- 0x6c, 0x79, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x69, 0x66, 0x20, 0x73, 0x61, 0x66, 0x65,
- 0x72, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x20, 0x6f, 0x72, 0x20,
- 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x20, 0x7e, 0x3d, 0x20, 0x31,
- 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x66, 0x69, 0x20, 0x3d,
- 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x66, 0x66, 0x69, 0x27, 0x29, 0x0a,
- 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6b, 0x2c, 0x20, 0x76, 0x20, 0x69, 0x6e, 0x20,
- 0x6e, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x66, 0x66, 0x69, 0x20, 0x64, 0x6f, 0x0a, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6b, 0x20, 0x7e, 0x3d, 0x20, 0x27, 0x67, 0x63,
- 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x66, 0x66, 0x69, 0x5b, 0x6b, 0x5d, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20,
- 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x66, 0x69, 0x20, 0x3d, 0x20, 0x6e, 0x69,
- 0x6c, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x6f, 0x73, 0x2e, 0x5b, 0x65,
- 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x7c, 0x6f, 0x73, 0x2e, 0x73, 0x70, 0x61, 0x77, 0x6e, 0x7c,
- 0x6f, 0x73, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x5d, 0x20, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79,
- 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65,
- 0x20, 0x61, 0x77, 0x61, 0x72, 0x65, 0x29, 0x0a, 0x0a, 0x0a, 0x69, 0x66, 0x20, 0x6d, 0x64, 0x35,
- 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x20, 0x73, 0x75, 0x6d, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6d, 0x64, 0x35, 0x2e, 0x73, 0x75,
- 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x67, 0x73, 0x75, 0x62,
- 0x20, 0x20, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x67, 0x73, 0x75, 0x62,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61,
- 0x74, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61,
- 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x62, 0x79, 0x74, 0x65,
- 0x20, 0x20, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x62, 0x79, 0x74, 0x65,
- 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d,
- 0x64, 0x35, 0x2e, 0x73, 0x75, 0x6d, 0x68, 0x65, 0x78, 0x61, 0x28, 0x6b, 0x29, 0x0a, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x28, 0x67, 0x73,
- 0x75, 0x62, 0x28, 0x73, 0x75, 0x6d, 0x28, 0x6b, 0x29, 0x2c, 0x20, 0x22, 0x2e, 0x22, 0x2c, 0x20,
- 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x63, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66,
- 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x28, 0x22, 0x25, 0x30, 0x32, 0x78, 0x22, 0x2c, 0x62, 0x79, 0x74,
- 0x65, 0x28, 0x63, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
- 0x64, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x20, 0x20, 0x20,
- 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x64, 0x35, 0x2e, 0x73, 0x75,
- 0x6d, 0x48, 0x45, 0x58, 0x41, 0x28, 0x6b, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x28, 0x67, 0x73, 0x75, 0x62, 0x28, 0x73, 0x75,
- 0x6d, 0x28, 0x6b, 0x29, 0x2c, 0x20, 0x22, 0x2e, 0x22, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74,
- 0x69, 0x6f, 0x6e, 0x28, 0x63, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,
- 0x28, 0x22, 0x25, 0x30, 0x32, 0x58, 0x22, 0x2c, 0x62, 0x79, 0x74, 0x65, 0x28, 0x63, 0x29, 0x29,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x29, 0x29, 0x0a, 0x20,
- 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x00
+ 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x69,
+ 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x22, 0x2c, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x78, 0x5f, 0x69,
+ 0x6f, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x29,
+ 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20,
+ 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28,
+ 0x22, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e,
+ 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6f, 0x73, 0x2e, 0x72,
+ 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x22, 0x29, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e,
+ 0x74, 0x6d, 0x70, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c,
+ 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x69, 0x6f, 0x2e, 0x74, 0x6d, 0x70, 0x66, 0x69,
+ 0x6c, 0x65, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x75, 0x74, 0x70,
+ 0x75, 0x74, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d,
+ 0x6d, 0x79, 0x28, 0x22, 0x69, 0x6f, 0x2e, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x29, 0x0a,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x66, 0x73, 0x2e, 0x63, 0x68, 0x64, 0x69, 0x72, 0x20, 0x20,
+ 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22,
+ 0x6c, 0x66, 0x73, 0x2e, 0x63, 0x68, 0x64, 0x69, 0x72, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x6c, 0x66, 0x73, 0x2e, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73,
+ 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6c, 0x66, 0x73, 0x2e, 0x6c,
+ 0x6f, 0x63, 0x6b, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x66, 0x73, 0x2e, 0x74, 0x6f,
+ 0x75, 0x63, 0x68, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75,
+ 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6c, 0x66, 0x73, 0x2e, 0x74, 0x6f, 0x75, 0x63, 0x68, 0x22, 0x29,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x66, 0x73, 0x2e, 0x72, 0x6d, 0x64, 0x69, 0x72, 0x20, 0x20,
+ 0x3d, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22,
+ 0x6c, 0x66, 0x73, 0x2e, 0x72, 0x6d, 0x64, 0x69, 0x72, 0x22, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x6c, 0x66, 0x73, 0x2e, 0x6d, 0x6b, 0x64, 0x69, 0x72, 0x20, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x73,
+ 0x74, 0x61, 0x6c, 0x6c, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x28, 0x22, 0x6c, 0x66, 0x73, 0x2e, 0x6d,
+ 0x6b, 0x64, 0x69, 0x72, 0x22, 0x29, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x69, 0x66, 0x20,
+ 0x73, 0x61, 0x66, 0x65, 0x72, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x3d, 0x20, 0x31,
+ 0x20, 0x6f, 0x72, 0x20, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x20,
+ 0x7e, 0x3d, 0x20, 0x31, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66,
+ 0x66, 0x69, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x66, 0x66,
+ 0x69, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6b, 0x2c, 0x20, 0x76,
+ 0x20, 0x69, 0x6e, 0x20, 0x6e, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x66, 0x66, 0x69, 0x20, 0x64, 0x6f,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6b, 0x20, 0x7e, 0x3d,
+ 0x20, 0x27, 0x67, 0x63, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x66, 0x69, 0x5b, 0x6b, 0x5d, 0x20, 0x3d, 0x20,
+ 0x6e, 0x69, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x66, 0x69, 0x20,
+ 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x2d, 0x2d, 0x20, 0x6f,
+ 0x73, 0x2e, 0x5b, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x7c, 0x6f, 0x73, 0x2e, 0x73, 0x70,
+ 0x61, 0x77, 0x6e, 0x7c, 0x6f, 0x73, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x5d, 0x20, 0x61, 0x6c, 0x72,
+ 0x65, 0x61, 0x64, 0x79, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x65, 0x73,
+ 0x63, 0x61, 0x70, 0x65, 0x20, 0x61, 0x77, 0x61, 0x72, 0x65, 0x29, 0x0a, 0x0a, 0x0a, 0x69, 0x66,
+ 0x20, 0x6d, 0x64, 0x35, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c,
+ 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x75, 0x6d, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x6d, 0x64,
+ 0x35, 0x2e, 0x73, 0x75, 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20,
+ 0x67, 0x73, 0x75, 0x62, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e,
+ 0x67, 0x73, 0x75, 0x62, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20,
+ 0x62, 0x79, 0x74, 0x65, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
+ 0x6f, 0x6e, 0x20, 0x6d, 0x64, 0x35, 0x2e, 0x73, 0x75, 0x6d, 0x68, 0x65, 0x78, 0x61, 0x28, 0x6b,
+ 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
+ 0x20, 0x28, 0x67, 0x73, 0x75, 0x62, 0x28, 0x73, 0x75, 0x6d, 0x28, 0x6b, 0x29, 0x2c, 0x20, 0x22,
+ 0x2e, 0x22, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x63, 0x29, 0x0a,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75,
+ 0x72, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x28, 0x22, 0x25, 0x30, 0x32, 0x78, 0x22,
+ 0x2c, 0x62, 0x79, 0x74, 0x65, 0x28, 0x63, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x65, 0x6e, 0x64, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a,
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x64,
+ 0x35, 0x2e, 0x73, 0x75, 0x6d, 0x48, 0x45, 0x58, 0x41, 0x28, 0x6b, 0x29, 0x0a, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x28, 0x67, 0x73, 0x75,
+ 0x62, 0x28, 0x73, 0x75, 0x6d, 0x28, 0x6b, 0x29, 0x2c, 0x20, 0x22, 0x2e, 0x22, 0x2c, 0x20, 0x66,
+ 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x63, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x6f,
+ 0x72, 0x6d, 0x61, 0x74, 0x28, 0x22, 0x25, 0x30, 0x32, 0x58, 0x22, 0x2c, 0x62, 0x79, 0x74, 0x65,
+ 0x28, 0x63, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64,
+ 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x0a,
+ 0x0a, 0x00
};
return luaL_dostring(L, (const char*) luatex_core_lua);
} \ No newline at end of file
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-core.lua b/Build/source/texk/web2c/luatexdir/lua/luatex-core.lua
index 15e0d8c830d..18bb7fcf0ed 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-core.lua
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-core.lua
@@ -1,213 +1,229 @@
--- if not modules then modules = { } end modules ['luatex-core'] = {
--- version = 1.001,
--- comment = 'companion to luatex',
--- author = 'Hans Hagen & Luigi Scarso',
--- copyright = 'LuaTeX Development Team',
--- }
-
-LUATEXCOREVERSION = 1.002
-
--- This file overloads some Lua functions. The readline variants provide the same
--- functionality as LuaTeX <= 1.04 and doing it this way permits us to keep the
--- original io libraries clean. Performance is probably even a bit better now.
-
-local type, next, getmetatable, require = type, next, getmetatable, require
-local find, gsub = string.find, string.gsub
-
-local io_open = io.open
-local io_popen = io.popen
-local io_lines = io.lines
-
-local fio_readline = fio.readline
-local fio_checkpermission = fio.checkpermission
-local fio_recordfilename = fio.recordfilename
-
-local mt = getmetatable(io.stderr)
-local mt_lines = mt.lines
-local saferoption = status.safer_option
-local shellescape = status.shell_escape -- 0 (disabled) 1 (anything) 2 (restricted)
-local kpseused = status.kpse_used -- 0 1
-
-io.saved_open = io_open -- can be protected
--- (deleted for tl17 rebuild) io.saved_popen = io_popen -- can be protected
-io.saved_lines = io_lines -- always readonly
-mt.saved_lines = mt_lines -- always readonly
-
-local function luatex_io_open(name,how)
- if not how then
- how = 'r'
- end
- local f = io_open(name,how)
- if f then
- if type(how) == 'string' and find(how,'w') then
- fio_recordfilename(name,'w')
- else
- fio_recordfilename(name,'r')
- end
- end
- return f
-end
-
-local function luatex_io_open_readonly(name,how)
- if how then
- how = 'r'
- else
- how = gsub(how,'[^rb]','')
- if how == '' then
- how = 'r'
- end
- end
- local f = io_open(name,how)
- if f then
- fio_recordfilename(name,'r')
- end
- return f
-end
-
-local function luatex_io_popen(name,...)
- local okay, found = fio_checkpermission(name)
- if okay and found then
- return io_popen(found,...)
- end
-end
-
-local function luatex_io_lines(name,how)
- if name then
- local f = io_open(name,how or 'r')
- if f then
- return function()
- return fio_readline(f)
- end
- end
- else
- return io_lines()
- end
-end
-
-local function luatex_io_readline(f)
- return function()
- return fio_readline(f)
- end
-end
-
-io.lines = luatex_io_lines
-mt.lines = luatex_io_readline
-
--- We assume management to be provided by the replacement of kpse. This is the
--- case in ConTeXt.
-
-if kpseused == 1 then
-
- io.open = luatex_io_open
- io.popen = luatex_io_popen
-
-end
-
-if saferoption == 1 then
-
- os.execute = nil
- os.spawn = nil
- os.exec = nil
- os.setenv = nil
- os.tempdir = nil
-
- io.popen = nil
- io.open = nil
-
- os.rename = nil
- os.remove = nil
-
- io.tmpfile = nil
- io.output = nil
-
- lfs.chdir = nil
- lfs.lock = nil
- lfs.touch = nil
- lfs.rmdir = nil
- lfs.mkdir = nil
-
- io.saved_open = luatex_io_open_readonly
-
-end
-
-if saferoption == 1 or shellescape ~= 1 then
-
- ffi = require('ffi')
- for k, v in next, ffi do
- if k ~= 'gc' then
- ffi[k] = nil
- end
- end
- ffi = nil
-
-end
-
--- os.[execute|os.spawn|os.exec] already are shellescape aware)
-
-
-if md5 then
-
- local sum = md5.sum
- local gsub = string.gsub
- local format = string.format
- local byte = string.byte
-
- function md5.sumhexa(k)
- return (gsub(sum(k), ".", function(c)
- return format("%02x",byte(c))
- end))
- end
-
- function md5.sumHEXA(k)
- return (gsub(sum(k), ".", function(c)
- return format("%02X",byte(c))
- end))
- end
-
-end
-
-if utilities and utilities.merger and utilities.merger.compact then
-
- local byte, format, gmatch = string.byte, string.format, string.gmatch
- local concat = table.concat
-
- local data = gsub(io.loaddata('luatex-core.lua'),'if%s+utilities.*','')
- local t = { }
- local r = { }
- local n = 0
- local d = gsub(data,'\r\n','\n') -- be nice for unix
- local s = utilities.merger.compact(d) -- no comments and less spaces
-
- t[#t+1] = '/* generated from and by luatex-core.lua */'
- t[#t+1] = ''
- -- t[#t+1] = format('/*\n\n%s\n\n*/',d)
- -- t[#t+1] = ''
- t[#t+1] = '#include "lua.h"'
- t[#t+1] = '#include "lauxlib.h"'
- t[#t+1] = ''
- t[#t+1] = 'int load_luatex_core_lua (lua_State * L);'
- t[#t+1] = ''
- t[#t+1] = 'int load_luatex_core_lua (lua_State * L)'
- t[#t+1] = '{'
- t[#t+1] = ' static unsigned char luatex_core_lua[] = {'
- for c in gmatch(d,'.') do
- if n == 16 then
- n = 1
- t[#t+1] = ' ' .. concat(r,', ') .. ','
- else
- n = n + 1
- end
- r[n] = format('0x%02x',byte(c))
- end
- n = n + 1
- r[n] = '0x00'
- t[#t+1] = ' ' .. concat(r,', ',1,n)
- t[#t+1] = ' };'
- -- t[#t+1] = format('unsigned int luatex_core_lua_len = 0x%x;',#d+1)
- t[#t+1] = ' return luaL_dostring(L, (const char*) luatex_core_lua);'
- t[#t+1] = '}'
-
- io.savedata('luatex-core.c',concat(t,'\n'))
- io.savedata('luatex-core-stripped.lua',s)
-
-end
+-- if not modules then modules = { } end modules ['luatex-core'] = {
+-- version = 1.001,
+-- comment = 'companion to luatex',
+-- author = 'Hans Hagen & Luigi Scarso',
+-- copyright = 'LuaTeX Development Team',
+-- }
+
+LUATEXCOREVERSION = 1.003
+
+-- This file overloads some Lua functions. The readline variants provide the same
+-- functionality as LuaTeX <= 1.04 and doing it this way permits us to keep the
+-- original io libraries clean. Performance is probably even a bit better now.
+
+local type, next, getmetatable, require = type, next, getmetatable, require
+local find, gsub, format = string.find, string.gsub, string.format
+
+local io_open = io.open
+local io_popen = io.popen
+local io_lines = io.lines
+
+local fio_readline = fio.readline
+local fio_checkpermission = fio.checkpermission
+local fio_recordfilename = fio.recordfilename
+
+local mt = getmetatable(io.stderr)
+local mt_lines = mt.lines
+local saferoption = status.safer_option
+local shellescape = status.shell_escape -- 0 (disabled) 1 (anything) 2 (restricted)
+local kpseused = status.kpse_used -- 0 1
+
+local write_nl = texio.write_nl
+
+io.saved_lines = io_lines -- always readonly
+mt.saved_lines = mt_lines -- always readonly
+
+local function luatex_io_open(name,how)
+ if not how then
+ how = 'r'
+ end
+ local f = io_open(name,how)
+ if f then
+ if type(how) == 'string' and find(how,'w') then
+ fio_recordfilename(name,'w')
+ else
+ fio_recordfilename(name,'r')
+ end
+ end
+ return f
+end
+
+local function luatex_io_open_readonly(name,how)
+ if how then
+ how = 'r'
+ else
+ how = gsub(how,'[^rb]','')
+ if how == '' then
+ how = 'r'
+ end
+ end
+ local f = io_open(name,how)
+ if f then
+ fio_recordfilename(name,'r')
+ end
+ return f
+end
+
+local function luatex_io_popen(name,...)
+ local okay, found = fio_checkpermission(name)
+ if okay and found then
+ return io_popen(found,...)
+ end
+end
+
+local function luatex_io_lines(name,how)
+ if name then
+ local f = io_open(name,how or 'r')
+ if f then
+ return function()
+ return fio_readline(f)
+ end
+ end
+ else
+ return io_lines()
+ end
+end
+
+local function luatex_io_readline(f)
+ return function()
+ return fio_readline(f)
+ end
+end
+
+io.lines = luatex_io_lines
+mt.lines = luatex_io_readline
+
+-- We assume management to be provided by the replacement of kpse. This is the
+-- case in ConTeXt.
+
+if kpseused == 1 then
+
+ io.open = luatex_io_open
+ io.popen = luatex_io_popen
+
+end
+
+if saferoption == 1 then
+
+ local function installdummy(str,f)
+ local reported = false
+ return function(...)
+ if not reported then
+ write_nl(format("safer option set, function %q is %s",
+ str,f and "limited" or "disabled"))
+ reported = true
+ end
+ if f then
+ return f(...)
+ end
+ end
+ end
+
+ local function installlimit(str,f)
+ local reported = false
+ end
+
+ os.execute = installdummy("os.execute")
+ os.spawn = installdummy("os.spawn")
+ os.exec = installdummy("os.exec")
+ os.setenv = installdummy("os.setenv")
+ os.tempdir = installdummy("os.tempdir")
+
+ io.popen = installdummy("io.popen")
+ io.open = installdummy("io.open",luatex_io_open_readonly)
+
+ os.rename = installdummy("os.rename")
+ os.remove = installdummy("os.remove")
+
+ io.tmpfile = installdummy("io.tmpfile")
+ io.output = installdummy("io.output")
+
+ lfs.chdir = installdummy("lfs.chdir")
+ lfs.lock = installdummy("lfs.lock")
+ lfs.touch = installdummy("lfs.touch")
+ lfs.rmdir = installdummy("lfs.rmdir")
+ lfs.mkdir = installdummy("lfs.mkdir")
+
+end
+
+if saferoption == 1 or shellescape ~= 1 then
+
+ ffi = require('ffi')
+ for k, v in next, ffi do
+ if k ~= 'gc' then
+ ffi[k] = nil
+ end
+ end
+ ffi = nil
+
+end
+
+-- os.[execute|os.spawn|os.exec] already are shellescape aware)
+
+
+if md5 then
+
+ local sum = md5.sum
+ local gsub = string.gsub
+ local format = string.format
+ local byte = string.byte
+
+ function md5.sumhexa(k)
+ return (gsub(sum(k), ".", function(c)
+ return format("%02x",byte(c))
+ end))
+ end
+
+ function md5.sumHEXA(k)
+ return (gsub(sum(k), ".", function(c)
+ return format("%02X",byte(c))
+ end))
+ end
+
+end
+
+if utilities and utilities.merger and utilities.merger.compact then
+
+ local byte, format, gmatch = string.byte, string.format, string.gmatch
+ local concat = table.concat
+
+ local data = gsub(io.loaddata('luatex-core.lua'),'if%s+utilities.*','')
+ local t = { }
+ local r = { }
+ local n = 0
+ local d = gsub(data,'\r\n','\n') -- be nice for unix
+ local s = utilities.merger.compact(d) -- no comments and less spaces
+
+ t[#t+1] = '/* generated from and by luatex-core.lua */'
+ t[#t+1] = ''
+ -- t[#t+1] = format('/*\n\n%s\n\n*/',d)
+ -- t[#t+1] = ''
+ t[#t+1] = '#include "lua.h"'
+ t[#t+1] = '#include "lauxlib.h"'
+ t[#t+1] = ''
+ t[#t+1] = 'int load_luatex_core_lua (lua_State * L);'
+ t[#t+1] = ''
+ t[#t+1] = 'int load_luatex_core_lua (lua_State * L)'
+ t[#t+1] = '{'
+ t[#t+1] = ' static unsigned char luatex_core_lua[] = {'
+ for c in gmatch(d,'.') do
+ if n == 16 then
+ n = 1
+ t[#t+1] = ' ' .. concat(r,', ') .. ','
+ else
+ n = n + 1
+ end
+ r[n] = format('0x%02x',byte(c))
+ end
+ n = n + 1
+ r[n] = '0x00'
+ t[#t+1] = ' ' .. concat(r,', ',1,n)
+ t[#t+1] = ' };'
+ -- t[#t+1] = format('unsigned int luatex_core_lua_len = 0x%x;',#d+1)
+ t[#t+1] = ' return luaL_dostring(L, (const char*) luatex_core_lua);'
+ t[#t+1] = '}'
+
+ io.savedata('luatex-core.c',concat(t,'\n'))
+ io.savedata('luatex-core-stripped.lua',s)
+
+end
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.w b/Build/source/texk/web2c/luatexdir/lua/luatoken.w
index a567c7f7a2b..e9740ffc676 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatoken.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.w
@@ -96,6 +96,7 @@ command_item command_names[] = {
{"boundary", boundary_cmd, NULL},
{"radical", radical_cmd, NULL},
{"super_sub_script", super_sub_script_cmd, NULL},
+ {"no_super_sub_script", no_super_sub_script_cmd, NULL},
{"math_shift_cs", math_shift_cs_cmd, NULL},
{"end_cs_name", end_cs_name_cmd, NULL},
{"char_ghost", char_ghost_cmd, NULL},