summaryrefslogtreecommitdiff
path: root/dev-lua/luaexpat/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-11-25 22:39:15 +0000
committerV3n3RiX <venerix@redcorelinux.org>2020-11-25 22:39:15 +0000
commitd934827bf44b7cfcf6711964418148fa60877668 (patch)
tree0625f358789b5e015e49db139cc1dbc9be00428f /dev-lua/luaexpat/files
parent2e34d110f164bf74d55fced27fe0000201b3eec5 (diff)
gentoo resync : 25.11.2020
Diffstat (limited to 'dev-lua/luaexpat/files')
-rw-r--r--dev-lua/luaexpat/files/luaexpat-1.3.3_getcurrentbytecount.patch33
-rw-r--r--dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch10
-rw-r--r--dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch109
3 files changed, 151 insertions, 1 deletions
diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_getcurrentbytecount.patch b/dev-lua/luaexpat/files/luaexpat-1.3.3_getcurrentbytecount.patch
new file mode 100644
index 000000000000..7366163d9d82
--- /dev/null
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_getcurrentbytecount.patch
@@ -0,0 +1,33 @@
+From 0926f2d705109b7d35b721344264b39c1169e0de Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fran=C3=A7ois=20Perrad?= <francois.perrad@gadz.org>
+Date: Sat, 16 Feb 2019 16:08:25 +0100
+Subject: [PATCH] restore method getcurrentbytecount
+
+fix #3
+---
+ src/lxplib.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index 7726913..35bec3c 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -538,11 +538,18 @@ static int lxp_stop (lua_State *L) {
+ return 1;
+ }
+
++static int lxp_getcurrentbytecount (lua_State* L) {
++ lxp_userdata *xpu = checkparser(L, 1);
++ lua_pushinteger(L, XML_GetCurrentByteCount(xpu->parser));
++ return 1;
++}
++
+ static const luaL_Reg lxp_meths[] = {
+ {"parse", lxp_parse},
+ {"close", lxp_close},
+ {"__gc", parser_gc},
+ {"pos", lxp_pos},
++ {"getcurrentbytecount", lxp_getcurrentbytecount},
+ {"setencoding", lxp_setencoding},
+ {"getcallbacks", getcallbacks},
+ {"getbase", getbase},
diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch b/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
index 95de7be60690..a780dddea838 100644
--- a/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
@@ -1,5 +1,5 @@
diff --git a/makefile b/makefile
-index 1a5a145..df09239 100644
+index 1a5a145..50912f0 100644
--- a/makefile
+++ b/makefile
@@ -45,7 +45,7 @@ OBJS= src/lxplib.o
@@ -11,3 +11,11 @@ index 1a5a145..df09239 100644
install:
mkdir -p $(LUA_LIBDIR)
+@@ -53,6 +53,7 @@ install:
+ cd $(LUA_LIBDIR); ln -f -s $(LIBNAME) $T.so
+ mkdir -p $(LUA_DIR)/$T
+ cp src/$T/lom.lua $(LUA_DIR)/$T
++ cp src/$T/totable.lua $(LUA_DIR)/$T
+
+ clean:
+ rm -f src/$(LIBNAME) $(OBJS)
diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch b/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch
new file mode 100644
index 000000000000..c0bc8c1a7b41
--- /dev/null
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch
@@ -0,0 +1,109 @@
+From 4ef48128bd9a725daca1d5a4aabe0c1665d78742 Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Wed, 2 Apr 2014 21:02:29 +0100
+Subject: [PATCH] Make merging of CharacterData events optional, controlled by
+ the 3rd parameter of lxp.new()
+
+---
+ src/lxplib.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index a7d6c42..794f6e3 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -57,6 +57,7 @@ struct lxp_userdata {
+ int tableref; /* table with callbacks for this parser */
+ enum XPState state;
+ luaL_Buffer *b; /* to concatenate sequences of cdata pieces */
++ int bufferCharData; /* whether to buffer cdata pieces */
+ };
+
+ typedef struct lxp_userdata lxp_userdata;
+@@ -171,8 +172,13 @@ static void f_CharData (void *ud, const char *s, int len) {
+ lxp_userdata *xpu = (lxp_userdata *)ud;
+ if (xpu->state == XPSok) {
+ if (getHandle(xpu, CharDataKey) == 0) return; /* no handle */
+- xpu->state = XPSstring;
+- luaL_buffinit(xpu->L, xpu->b);
++ if(xpu->bufferCharData != 0) {
++ xpu->state = XPSstring;
++ luaL_buffinit(xpu->L, xpu->b);
++ } else {
++ lua_pushlstring(xpu->L, s, len);
++ docall(xpu, 1, 0);
++ }
+ }
+ if (xpu->state == XPSstring)
+ luaL_addlstring(xpu->b, s, len);
+@@ -393,8 +399,10 @@ static void checkcallbacks (lua_State *L) {
+
+ static int lxp_make_parser (lua_State *L) {
+ XML_Parser p;
++ int bufferCharData = (lua_type(L, 3) != LUA_TBOOLEAN) || (lua_toboolean(L, 3) != 0);
+ char sep = *luaL_optstring(L, 2, "");
+ lxp_userdata *xpu = createlxp(L);
++ xpu->bufferCharData = bufferCharData;
+ p = xpu->parser = (sep == '\0') ? XML_ParserCreate(NULL) :
+ XML_ParserCreateNS(NULL, sep);
+ if (!p)
+From cbaf85740f6032cfc025c7bde3f9861d15825928 Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Wed, 2 Apr 2014 20:56:58 +0100
+Subject: [PATCH] Add support for XmlDecl handlers
+
+---
+ src/lxplib.c | 14 +++++++++++++-
+ src/lxplib.h | 1 +
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index 35bec3c..a7d6c42 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -345,6 +345,16 @@ static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName,
+ docall(xpu, 4, 0);
+ }
+
++static void f_XmlDecl (void *ud, const XML_Char *version,
++ const XML_Char *encoding,
++ int standalone) {
++ lxp_userdata *xpu = (lxp_userdata *)ud;
++ if (getHandle(xpu, XmlDeclKey) == 0) return; /* no handle */
++ lua_pushstring(xpu->L, version);
++ lua_pushstring(xpu->L, encoding);
++ lua_pushboolean(xpu->L, standalone);
++ docall(xpu, 3, 0);
++}
+ /* }====================================================== */
+
+
+@@ -365,7 +375,7 @@ static void checkcallbacks (lua_State *L) {
+ "Default", "DefaultExpand", "StartElement", "EndElement",
+ "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl",
+ "NotationDecl", "NotStandalone", "ProcessingInstruction",
+- "UnparsedEntityDecl", "StartDoctypeDecl", NULL};
++ "UnparsedEntityDecl", "StartDoctypeDecl", "XmlDecl", NULL};
+ if (hasfield(L, "_nonstrict")) return;
+ lua_pushnil(L);
+ while (lua_next(L, 1)) {
+@@ -420,6 +430,8 @@ static int lxp_make_parser (lua_State *L) {
+ XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl);
+ if (hasfield(L, StartDoctypeDeclKey))
+ XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl);
++ if (hasfield(L, XmlDeclKey))
++ XML_SetXmlDeclHandler(p, f_XmlDecl);
+ return 1;
+ }
+
+diff --git a/src/lxplib.h b/src/lxplib.h
+index 9c0be4f..4c7084c 100644
+--- a/src/lxplib.h
++++ b/src/lxplib.h
+@@ -20,5 +20,6 @@
+ #define ProcessingInstructionKey "ProcessingInstruction"
+ #define UnparsedEntityDeclKey "UnparsedEntityDecl"
+ #define StartDoctypeDeclKey "StartDoctypeDecl"
++#define XmlDeclKey "XmlDecl"
+
+ int luaopen_lxp (lua_State *L);