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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
$NetBSD: patch-ad,v 1.3 2012/07/04 20:31:56 drochner Exp $
--- texk/web2c/luatexdir/lua/lepdflib.cc.orig 2011-05-19 05:38:37.000000000 +0000
+++ texk/web2c/luatexdir/lua/lepdflib.cc
@@ -89,7 +89,9 @@ new_poppler_userdata(AnnotBorder);
new_poppler_userdata(Annots);
new_poppler_userdata(Array);
new_poppler_userdata(Catalog);
+#if 0
new_poppler_userdata(EmbFile);
+#endif
new_poppler_userdata(Dict);
//new_poppler_userdata(GooString);
new_poppler_userdata(LinkDest);
@@ -152,7 +154,7 @@ static int l_new_Annot(lua_State * L)
pdfdoc_changed_error(L);
uout = new_Annot_userdata(L);
uout->d =
- new Annot((XRef *) uxref->d, (Dict *) udict->d, (Catalog *) ucatalog->d,
+ new Annot((PDFDoc *) uxref->d, (Dict *) udict->d,
(Object *) uref->d);
uout->atype = ALLOC_LEPDF;
uout->pc = uxref->pc;
@@ -174,7 +176,7 @@ static int l_new_Annots(lua_State * L)
pdfdoc_changed_error(L);
uout = new_Annots_userdata(L);
uout->d =
- new Annots((XRef *) uxref->d, (Catalog *) ucatalog->d,
+ new Annots((PDFDoc *) uxref->d,
(Object *) uannotsobj->d);
uout->atype = ALLOC_LEPDF;
uout->pc = uxref->pc;
@@ -364,7 +366,7 @@ static int m_##type##__tostring(lua_Stat
// Annot
m_poppler_get_BOOL(Annot, isOk);
-m_poppler_get_OBJECT(Annot, getAppearance);
+m_poppler_get_OBJECT(Annot, getAppearanceResDict);
m_poppler_get_poppler(Annot, AnnotBorder, getBorder);
static int m_Annot_match(lua_State * L)
@@ -393,13 +395,17 @@ static int m_Annot__gc(lua_State * L)
printf("\n===== Annot GC ===== uin=<%p>\n", uin);
#endif
if (uin->atype == ALLOC_LEPDF)
+#if 0
delete(Annot *) uin->d;
+#else
+ ((Annot *) uin->d)->decRefCnt();
+#endif
return 0;
}
static const struct luaL_Reg Annot_m[] = {
{"isOk", m_Annot_isOk},
- {"getAppearance", m_Annot_getAppearance},
+ {"getAppearance", m_Annot_getAppearanceResDict},
{"getBorder", m_Annot_getBorder},
{"match", m_Annot_match},
{"__tostring", m_Annot__tostring},
@@ -410,6 +416,8 @@ static const struct luaL_Reg Annot_m[] =
//**********************************************************************
// AnnotBorderStyle
+#if 0
+
m_poppler_get_DOUBLE(AnnotBorderStyle, getWidth);
m_poppler__tostring(AnnotBorderStyle);
@@ -435,6 +443,8 @@ static const struct luaL_Reg AnnotBorder
{NULL, NULL} // sentinel
};
+#endif
+
//**********************************************************************
// Annots
@@ -684,6 +694,7 @@ static int m_Catalog_findDest(lua_State
m_poppler_get_poppler(Catalog, Object, getDests);
m_poppler_get_INT(Catalog, numEmbeddedFiles);
+#if 0
static int m_Catalog_embeddedFile(lua_State * L)
{
EmbFile *ef;
@@ -707,6 +718,7 @@ static int m_Catalog_embeddedFile(lua_St
lua_pushnil(L);
return 1;
}
+#endif
m_poppler_get_INT(Catalog, numJS);
@@ -749,7 +761,9 @@ static const struct luaL_Reg Catalog_m[]
{"findDest", m_Catalog_findDest},
{"getDests", m_Catalog_getDests},
{"numEmbeddedFiles", m_Catalog_numEmbeddedFiles},
+#if 0
{"embeddedFile", m_Catalog_embeddedFile},
+#endif
{"numJS", m_Catalog_numJS},
{"getJS", m_Catalog_getJS},
{"getOutline", m_Catalog_getOutline},
@@ -761,6 +775,8 @@ static const struct luaL_Reg Catalog_m[]
//**********************************************************************
// EmbFile
+#if 0
+
m_poppler_get_GOOSTRING(EmbFile, name);
m_poppler_get_GOOSTRING(EmbFile, description);
m_poppler_get_INT(EmbFile, size);
@@ -801,6 +817,8 @@ static const struct luaL_Reg EmbFile_m[]
{NULL, NULL} // sentinel
};
+#endif
+
//**********************************************************************
// Dict
@@ -1347,7 +1365,7 @@ static int m_Object_getType(lua_State *
static int m_Object_getTypeName(lua_State * L)
{
- char *s;
+ const char *s;
udstruct *uin;
uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
@@ -2034,7 +2052,7 @@ static int m_Page_getLinks(lua_State * L
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
|| (ucat->pd != NULL && ucat->pd->pc != ucat->pd->pc))
pdfdoc_changed_error(L);
- links = ((Page *) uin->d)->getLinks((Catalog *) ucat->d);
+ links = ((Page *) uin->d)->getLinks();
if (links != NULL) {
uout = new_Links_userdata(L);
uout->d = links;
@@ -2629,7 +2647,10 @@ m_poppler_get_INT(XRef, getNumObjects);
m_poppler_get_INT(XRef, getRootNum);
m_poppler_get_INT(XRef, getRootGen);
// getStreamEnd
-m_poppler_get_INT(XRef, getSize);
+static int m_XRef_getSize(lua_State * L)
+{
+ return m_XRef_getNumObjects(L);
+}
// getEntry
m_poppler_get_poppler(XRef, Object, getTrailerDict);
@@ -2683,11 +2704,15 @@ int luaopen_epdf(lua_State * L)
{
register_meta(Annot);
// TODO register_meta(AnnotBorder);
+#if 0
register_meta(AnnotBorderStyle);
+#endif
register_meta(Annots);
register_meta(Array);
register_meta(Catalog);
+#if 0
register_meta(EmbFile);
+#endif
register_meta(Dict);
register_meta(GooString);
register_meta(LinkDest);
|