summaryrefslogtreecommitdiff
blob: f7b5ba35b488a2434e68897dce3b262701ae7ef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
Source: NetBSD CVS
http://mail-index.netbsd.org/pkgsrc-bugs/2014/04/29/msg053974.html
http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/pkgsrc/print/luatex/patches/


diff -ruN luatex-beta-0.76.0.orig/source/texk/web2c/luatexdir/image/epdf.h luatex-beta-0.76.0/source/texk/web2c/luatexdir/image/epdf.h
--- luatex-beta-0.76.0.orig/source/texk/web2c/luatexdir/image/epdf.h	2013-04-05 12:58:37.000000000 +0200
+++ luatex-beta-0.76.0/source/texk/web2c/luatexdir/image/epdf.h	2014-05-01 01:39:39.838462783 +0200
@@ -37,6 +37,7 @@
 #  include <sys/stat.h>
 #  include <dirent.h>
 #  include <poppler-config.h>
+#  include <StructTreeRoot.h>
 #  include <goo/GooString.h>
 #  include <goo/gmem.h>
 #  include <goo/gfile.h>
diff -ruN luatex-beta-0.76.0.orig/source/texk/web2c/luatexdir/lua/lepdflib.cc luatex-beta-0.76.0/source/texk/web2c/luatexdir/lua/lepdflib.cc
--- luatex-beta-0.76.0.orig/source/texk/web2c/luatexdir/lua/lepdflib.cc	2013-04-05 12:58:37.000000000 +0200
+++ luatex-beta-0.76.0/source/texk/web2c/luatexdir/lua/lepdflib.cc	2014-05-01 01:40:15.698461067 +0200
@@ -48,25 +48,26 @@
 
 //**********************************************************************
 
-#define M_Annot            "Annot"
-#define M_Annots           "Annots"
-#define M_Array            "Array"
-#define M_Catalog          "Catalog"
-#define M_Dict             "Dict"
-#define M_EmbFile          "EmbFile"
-#define M_FileSpec         "FileSpec"
-#define M_GooString        "GooString"
-#define M_LinkDest         "LinkDest"
-#define M_Link             "Link"
-#define M_Links            "Links"
-#define M_Object           "Object"
-#define M_Page             "Page"
-#define M_PDFDoc           "PDFDoc"
-#define M_PDFRectangle     "PDFRectangle"
-#define M_Ref              "Ref"
-#define M_Stream           "Stream"
-#define M_XRefEntry        "XRefEntry"
-#define M_XRef             "XRef"
+#define M_Annot            "epdf.Annot" /* ls-hh: epdf.* gives better protection in registry */
+#define M_Annots           "epdf.Annots"
+#define M_Array            "epdf.Array"
+#define M_Catalog          "epdf.Catalog"
+#define M_Dict             "epdf.Dict"
+#define M_EmbFile          "epdf.EmbFile"
+#define M_FileSpec         "epdf.FileSpec"
+#define M_GooString        "epdf.GooString"
+#define M_LinkDest         "epdf.LinkDest"
+#define M_Link             "epdf.Link"
+#define M_Links            "epdf.Links"
+#define M_Object           "epdf.Object"
+#define M_Page             "epdf.Page"
+#define M_PDFDoc           "epdf.PDFDoc"
+#define M_PDFRectangle     "epdf.PDFRectangle"
+#define M_Ref              "epdf.Ref"
+#define M_Stream           "epdf.Stream"
+#define M_StructTreeRoot   "epdf.StructTreeRoot"
+#define M_XRefEntry        "epdf.XRefEntry"
+#define M_XRef             "epdf.XRef"
 
 //**********************************************************************
 
@@ -96,6 +97,7 @@
 new_poppler_userdata(PDFRectangle);
 new_poppler_userdata(Ref);
 new_poppler_userdata(Stream);
+new_poppler_userdata(StructTreeRoot);
 new_poppler_userdata(XRef);
 
 //**********************************************************************
@@ -573,7 +575,11 @@
 
 m_poppler_get_GOOSTRING(Catalog, getBaseURI);
 m_poppler_get_GOOSTRING(Catalog, readMetadata);
+#ifdef GETSTRUCTTREEROOT_RETURNS_OBJECT
 m_poppler_get_poppler(Catalog, Object, getStructTreeRoot);
+#else
+m_poppler_get_poppler(Catalog, StructTreeRoot, getStructTreeRoot);
+#endif
 
 static int m_Catalog_findPage(lua_State * L)
 {
@@ -2146,14 +2152,22 @@
 
 static int m_PDFDoc_getStructTreeRoot(lua_State * L)
 {
+#ifdef GETSTRUCTTREEROOT_RETURNS_OBJECT
     Object *obj;
+#else
+    StructTreeRoot *obj;
+#endif
     udstruct *uin, *uout;
     uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
     if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
         obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
+#ifdef GETSTRUCTTREEROOT_RETURNS_OBJECT
         uout = new_Object_userdata(L);
+#else
+        uout = new_StructTreeRoot_userdata(L);
+#endif
         uout->d = obj;
         uout->pc = uin->pc;
         uout->pd = uin->pd;
@@ -2617,6 +2631,15 @@
 
 //**********************************************************************
 
+#ifdef LuajitTeX
+#define setfuncs_meta(type)                 \
+    luaL_newmetatable(L, M_##type);         \
+    lua_pushvalue(L, -1);                   \
+    lua_setfield(L, -2, "__index");         \
+    lua_pushstring(L, "no user access");    \
+    lua_setfield(L, -2, "__metatable");     \
+    luaL_register(L, NULL, type##_m)
+#else
 #define setfuncs_meta(type)                 \
     luaL_newmetatable(L, M_##type);         \
     lua_pushvalue(L, -1);                   \
@@ -2624,6 +2647,7 @@
     lua_pushstring(L, "no user access");    \
     lua_setfield(L, -2, "__metatable");     \
     luaL_setfuncs(L, type##_m, 0)
+#endif
 
 int luaopen_epdf(lua_State * L)
 {
@@ -2646,6 +2670,10 @@
     setfuncs_meta(XRef);
     setfuncs_meta(XRefEntry);
 
+#ifdef LuajitTeX
+    luaL_register(L, "epdf", epdflib_f);
+#else
     luaL_newlib(L, epdflib_f);
+#endif
     return 1;
 }