]>
Commit | Line | Data |
---|---|---|
d6750f79 AF |
1 | --- php-4.1.2/ext/pdf/pdf.c.wiget Fri Oct 12 01:51:53 2001 |
2 | +++ php-4.1.2/ext/pdf/pdf.c Tue Jan 29 15:12:31 2002 | |
3 | @@ -17,7 +17,18 @@ | |
4 | +----------------------------------------------------------------------+ | |
5 | */ | |
6 | ||
7 | -/* $Id$ */ | |
8 | +/* $Id$ */ | |
9 | +/* derived from: | |
10 | + Id: pdf.c,v 1.105 2001/11/30 04:46:35 sniper Exp | |
11 | + | |
12 | + with some exeptions: | |
13 | + - pdf_get_major/minorversion not included, as pdf_get_value supports this | |
14 | + now without a PDF-object | |
15 | + - #if ZEND_MODULE_API_NO >= 20010901 for new ZEND_MODULE support, | |
16 | + so that it compiles with older PHP Versions too | |
17 | + - TSRMLS fixes included only with ZEND_MODULE_API_NO >= 20010901 | |
18 | + would break older builds otherwise | |
19 | + */ | |
20 | ||
21 | /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. | |
22 | Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ | |
23 | @@ -236,7 +247,9 @@ | |
24 | /* {{{ pdf_module_entry | |
25 | */ | |
26 | zend_module_entry pdf_module_entry = { | |
27 | +#if ZEND_MODULE_API_NO >= 20010901 | |
28 | STANDARD_MODULE_HEADER, | |
29 | +#endif | |
30 | "pdf", | |
31 | pdf_functions, | |
32 | PHP_MINIT(pdf), | |
33 | @@ -244,7 +257,9 @@ | |
34 | NULL, | |
35 | NULL, | |
36 | PHP_MINFO(pdf), | |
37 | +#if ZEND_MODULE_API_NO >= 20010901 | |
38 | NO_VERSION_YET, | |
39 | +#endif | |
40 | STANDARD_MODULE_PROPERTIES | |
41 | }; | |
42 | /* }}} */ | |
43 | @@ -255,14 +270,10 @@ | |
44 | ||
45 | /* {{{ _free_pdf_doc | |
46 | */ | |
47 | -static void _free_pdf_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC) | |
48 | +static void _free_pdf_doc(zend_rsrc_list_entry *rsrc) | |
49 | { | |
50 | - /* RJS: TODO: | |
51 | PDF *pdf = (PDF *)rsrc->ptr; | |
52 | - check whether pdf-Pointer is still valid, before pdf_delete() | |
53 | - + remove php-resource */ | |
54 | - /* PDF_delete(pdf); | |
55 | -*/ | |
56 | + PDF_delete(pdf); | |
57 | } | |
58 | /* }}} */ | |
59 | ||
60 | @@ -327,9 +338,14 @@ | |
61 | */ | |
62 | static size_t pdf_flushwrite(PDF *p, void *data, size_t size) | |
63 | { | |
64 | +#if ZEND_MODULE_API_NO >= 20010901 | |
65 | TSRMLS_FETCH(); | |
66 | ||
67 | return(php_write(data, size TSRMLS_CC)); | |
68 | +#else | |
69 | + return(php_write(data, size)); | |
70 | +#endif | |
71 | + return 0; | |
72 | } | |
73 | /* }}} */ | |
74 | ||
75 | @@ -349,7 +365,7 @@ | |
76 | #else | |
77 | php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); | |
78 | #endif | |
79 | - php_info_print_table_row(2, "Revision", "$Revision$" ); | |
80 | + php_info_print_table_row(2, "Revision", "$Revision$" ); | |
81 | php_info_print_table_end(); | |
82 | ||
83 | } | |
84 | @@ -402,7 +418,7 @@ | |
85 | ||
86 | /* {{{ proto bool pdf_set_info(int pdfdoc, string fieldname, string value) | |
87 | Fills an info field of the document */ | |
88 | -PHP_FUNCTION(pdf_set_info) | |
89 | +PHP_FUNCTION(pdf_set_info) | |
90 | { | |
91 | zval **arg1, **arg2, **arg3; | |
92 | PDF *pdf; | |
93 | @@ -447,7 +463,7 @@ | |
94 | ||
95 | /* {{{ proto bool pdf_set_info_author(int pdfdoc, string author) | |
96 | Fills the author field of the document */ | |
97 | -PHP_FUNCTION(pdf_set_info_author) | |
98 | +PHP_FUNCTION(pdf_set_info_author) | |
99 | { | |
100 | _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Author"); | |
101 | } | |
102 | @@ -463,7 +479,7 @@ | |
103 | ||
104 | /* {{{ proto int pdf_open([int filedesc]) | |
105 | Opens a new pdf document. If filedesc is NULL, document is created in memory. This is the old interface, only for compatibility use pdf_new + pdf_open_file instead */ | |
106 | -PHP_FUNCTION(pdf_open) | |
107 | +PHP_FUNCTION(pdf_open) | |
108 | { | |
109 | zval **file; | |
110 | FILE *fp; | |
111 | @@ -498,7 +514,7 @@ | |
112 | ||
113 | /* {{{ proto void pdf_close(int pdfdoc) | |
114 | Closes the pdf document */ | |
115 | -PHP_FUNCTION(pdf_close) | |
116 | +PHP_FUNCTION(pdf_close) | |
117 | { | |
118 | zval **arg1; | |
119 | PDF *pdf; | |
120 | @@ -516,9 +532,9 @@ | |
121 | ||
122 | /* }}} */ | |
123 | ||
124 | -/* {{{ proto void pdf_begin_page(int pdfdoc, double width, double height) | |
125 | +/* {{{ proto void pdf_begin_page(int pdfdoc, float width, float height) | |
126 | Starts page */ | |
127 | -PHP_FUNCTION(pdf_begin_page) | |
128 | +PHP_FUNCTION(pdf_begin_page) | |
129 | { | |
130 | zval **arg1, **arg2, **arg3; | |
131 | PDF *pdf; | |
132 | @@ -538,7 +554,7 @@ | |
133 | ||
134 | /* {{{ proto void pdf_end_page(int pdfdoc) | |
135 | Ends page */ | |
136 | -PHP_FUNCTION(pdf_end_page) | |
137 | +PHP_FUNCTION(pdf_end_page) | |
138 | { | |
139 | zval **arg1; | |
140 | PDF *pdf; | |
141 | @@ -556,7 +572,7 @@ | |
142 | ||
143 | /* {{{ proto void pdf_show(int pdfdoc, string text) | |
144 | Output text at current position */ | |
145 | -PHP_FUNCTION(pdf_show) | |
146 | +PHP_FUNCTION(pdf_show) | |
147 | { | |
148 | zval **arg1, **arg2; | |
149 | PDF *pdf; | |
150 | @@ -573,9 +589,9 @@ | |
151 | } | |
152 | /* }}} */ | |
153 | ||
154 | -/* {{{ proto void pdf_show_xy(int pdfdoc, string text, double x-koor, double y-koor) | |
155 | +/* {{{ proto void pdf_show_xy(int pdfdoc, string text, float x_koor, float y_koor) | |
156 | Output text at position */ | |
157 | -PHP_FUNCTION(pdf_show_xy) | |
158 | +PHP_FUNCTION(pdf_show_xy) | |
159 | { | |
160 | zval **arg1, **arg2, **arg3, **arg4; | |
161 | PDF *pdf; | |
162 | @@ -594,9 +610,9 @@ | |
163 | } | |
164 | /* }}} */ | |
165 | ||
166 | -/* {{{ proto int pdf_show_boxed(int pdfdoc, string text, double x-koor, double y-koor, double width, double height, string mode [, string feature]) | |
167 | +/* {{{ proto int pdf_show_boxed(int pdfdoc, string text, float x_koor, float y_koor, float width, float height, string mode [, string feature]) | |
168 | Output text formated in a boxed */ | |
169 | -PHP_FUNCTION(pdf_show_boxed) | |
170 | +PHP_FUNCTION(pdf_show_boxed) | |
171 | { | |
172 | zval **argv[8]; | |
173 | int argc = ZEND_NUM_ARGS(); | |
174 | @@ -636,9 +652,9 @@ | |
175 | } | |
176 | /* }}} */ | |
177 | ||
178 | -/* {{{ proto void pdf_set_font(int pdfdoc, string font, double size, string encoding [, int embed]) | |
179 | +/* {{{ proto void pdf_set_font(int pdfdoc, string font, float size, string encoding [, int embed]) | |
180 | Select the current font face, size and encoding */ | |
181 | -PHP_FUNCTION(pdf_set_font) | |
182 | +PHP_FUNCTION(pdf_set_font) | |
183 | { | |
184 | zval **arg1, **arg2, **arg3, **arg4, **arg5; | |
185 | int font, embed; | |
186 | @@ -699,7 +715,7 @@ | |
187 | } | |
188 | /* }}} */ | |
189 | ||
190 | -/* {{{ proto void pdf_set_value(int pdfdoc, string key, double value) | |
191 | +/* {{{ proto void pdf_set_value(int pdfdoc, string key, float value) | |
192 | Sets arbitrary value */ | |
193 | PHP_FUNCTION(pdf_set_value) | |
194 | { | |
195 | @@ -720,7 +736,7 @@ | |
196 | } | |
197 | /* }}} */ | |
198 | ||
199 | -/* {{{ proto double pdf_get_value(int pdfdoc, string key, double modifier) | |
200 | +/* {{{ proto float pdf_get_value(int pdfdoc, string key, float modifier) | |
201 | Gets arbitrary value */ | |
202 | PHP_FUNCTION(pdf_get_value) | |
203 | { | |
204 | @@ -751,6 +767,15 @@ | |
205 | } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "resy"))) { | |
206 | if(argc < 3) WRONG_PARAM_COUNT; | |
207 | value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET); | |
208 | + } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "capheight"))) { | |
209 | + if(argc < 3) WRONG_PARAM_COUNT; | |
210 | + value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_FONT_OFFSET); | |
211 | + } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "ascender"))) { | |
212 | + if(argc < 3) WRONG_PARAM_COUNT; | |
213 | + value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_FONT_OFFSET); | |
214 | + } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "descender"))) { | |
215 | + if(argc < 3) WRONG_PARAM_COUNT; | |
216 | + value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_FONT_OFFSET); | |
217 | } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "font"))) { | |
218 | value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), 0.0)+PDFLIB_FONT_OFFSET; | |
219 | } else { | |
220 | @@ -803,7 +828,7 @@ | |
221 | } | |
222 | /* }}} */ | |
223 | ||
224 | -/* {{{ proto double pdf_get_fontsize(int pdfdoc) | |
225 | +/* {{{ proto float pdf_get_fontsize(int pdfdoc) | |
226 | Gets the current font size */ | |
227 | PHP_FUNCTION(pdf_get_fontsize) | |
228 | { | |
229 | @@ -822,7 +847,7 @@ | |
230 | } | |
231 | /* }}} */ | |
232 | ||
233 | -/* {{{ proto void pdf_set_leading(int pdfdoc, double distance) | |
234 | +/* {{{ proto void pdf_set_leading(int pdfdoc, float distance) | |
235 | Sets distance between text lines */ | |
236 | PHP_FUNCTION(pdf_set_leading) | |
237 | { | |
238 | @@ -838,7 +863,7 @@ | |
239 | } | |
240 | /* }}} */ | |
241 | ||
242 | -/* {{{ proto void pdf_set_horiz_scaling(int pdfdoc, double scale) | |
243 | +/* {{{ proto void pdf_set_horiz_scaling(int pdfdoc, float scale) | |
244 | Sets horizontal scaling of text */ | |
245 | PHP_FUNCTION(pdf_set_horiz_scaling) | |
246 | { | |
247 | @@ -846,7 +871,7 @@ | |
248 | } | |
249 | /* }}} */ | |
250 | ||
251 | -/* {{{ proto void pdf_set_text_rise(int pdfdoc, double value) | |
252 | +/* {{{ proto void pdf_set_text_rise(int pdfdoc, float value) | |
253 | Sets the text rise */ | |
254 | PHP_FUNCTION(pdf_set_text_rise) | |
255 | { | |
256 | @@ -854,7 +879,7 @@ | |
257 | } | |
258 | /* }}} */ | |
259 | ||
260 | -/* {{{ proto void pdf_set_char_spacing(int pdfdoc, double space) | |
261 | +/* {{{ proto void pdf_set_char_spacing(int pdfdoc, float space) | |
262 | Sets character spacing */ | |
263 | PHP_FUNCTION(pdf_set_char_spacing) | |
264 | { | |
265 | @@ -862,7 +887,7 @@ | |
266 | } | |
267 | /* }}} */ | |
268 | ||
269 | -/* {{{ proto void pdf_set_word_spacing(int pdfdoc, double space) | |
270 | +/* {{{ proto void pdf_set_word_spacing(int pdfdoc, float space) | |
271 | Sets spacing between words */ | |
272 | PHP_FUNCTION(pdf_set_word_spacing) | |
273 | { | |
274 | @@ -870,7 +895,7 @@ | |
275 | } | |
276 | /* }}} */ | |
277 | ||
278 | -/* {{{ proto void pdf_set_text_pos(int pdfdoc, double x, double y) | |
279 | +/* {{{ proto void pdf_set_text_pos(int pdfdoc, float x, float y) | |
280 | Sets the position of text for the next pdf_show call */ | |
281 | PHP_FUNCTION(pdf_set_text_pos) | |
282 | { | |
283 | @@ -909,7 +934,7 @@ | |
284 | } | |
285 | /* }}} */ | |
286 | ||
287 | -/* {{{ proto double pdf_stringwidth(int pdfdoc, string text [, int font, double size]) | |
288 | +/* {{{ proto float pdf_stringwidth(int pdfdoc, string text [, int font, float size]) | |
289 | Returns width of text in current font */ | |
290 | PHP_FUNCTION(pdf_stringwidth) | |
291 | { | |
292 | @@ -990,7 +1015,7 @@ | |
293 | } | |
294 | /* }}} */ | |
295 | ||
296 | -/* {{{ proto void pdf_translate(int pdfdoc, double x, double y) | |
297 | +/* {{{ proto void pdf_translate(int pdfdoc, float x, float y) | |
298 | Sets origin of coordinate system */ | |
299 | PHP_FUNCTION(pdf_translate) | |
300 | { | |
301 | @@ -1010,7 +1035,7 @@ | |
302 | } | |
303 | /* }}} */ | |
304 | ||
305 | -/* {{{ proto void pdf_scale(int pdfdoc, double x-scale, double y-scale) | |
306 | +/* {{{ proto void pdf_scale(int pdfdoc, float x_scale, float y_scale) | |
307 | Sets scaling */ | |
308 | PHP_FUNCTION(pdf_scale) | |
309 | { | |
310 | @@ -1030,7 +1055,7 @@ | |
311 | } | |
312 | /* }}} */ | |
313 | ||
314 | -/* {{{ proto void pdf_rotate(int pdfdoc, double angle) | |
315 | +/* {{{ proto void pdf_rotate(int pdfdoc, float angle) | |
316 | Sets rotation */ | |
317 | PHP_FUNCTION(pdf_rotate) | |
318 | { | |
319 | @@ -1049,7 +1074,7 @@ | |
320 | } | |
321 | /* }}} */ | |
322 | ||
323 | -/* {{{ proto void pdf_skew(int pdfdoc, double xangle, double yangle) | |
324 | +/* {{{ proto void pdf_skew(int pdfdoc, float xangle, float yangle) | |
325 | Skew the coordinate system */ | |
326 | PHP_FUNCTION(pdf_skew) | |
327 | { | |
328 | @@ -1069,7 +1094,7 @@ | |
329 | } | |
330 | /* }}} */ | |
331 | ||
332 | -/* {{{ proto void pdf_setflat(int pdfdoc, double value) | |
333 | +/* {{{ proto void pdf_setflat(int pdfdoc, float value) | |
334 | Sets flatness */ | |
335 | PHP_FUNCTION(pdf_setflat) | |
336 | { | |
337 | @@ -1147,7 +1172,7 @@ | |
338 | } | |
339 | /* }}} */ | |
340 | ||
341 | -/* {{{ proto void pdf_setmiterlimit(int pdfdoc, double value) | |
342 | +/* {{{ proto void pdf_setmiterlimit(int pdfdoc, float value) | |
343 | Sets miter limit */ | |
344 | PHP_FUNCTION(pdf_setmiterlimit) | |
345 | { | |
346 | @@ -1173,7 +1198,7 @@ | |
347 | } | |
348 | /* }}} */ | |
349 | ||
350 | -/* {{{ proto void pdf_setlinewidth(int pdfdoc, double width) | |
351 | +/* {{{ proto void pdf_setlinewidth(int pdfdoc, float width) | |
352 | Sets line width */ | |
353 | PHP_FUNCTION(pdf_setlinewidth) | |
354 | { | |
355 | @@ -1192,7 +1217,7 @@ | |
356 | } | |
357 | /* }}} */ | |
358 | ||
359 | -/* {{{ proto void pdf_setdash(int pdfdoc, double black, double white) | |
360 | +/* {{{ proto void pdf_setdash(int pdfdoc, float black, float white) | |
361 | Sets dash pattern */ | |
362 | PHP_FUNCTION(pdf_setdash) | |
363 | { | |
364 | @@ -1212,7 +1237,7 @@ | |
365 | } | |
366 | /* }}} */ | |
367 | ||
368 | -/* {{{ proto void pdf_moveto(int pdfdoc, double x, double y) | |
369 | +/* {{{ proto void pdf_moveto(int pdfdoc, float x, float y) | |
370 | Sets current point */ | |
371 | PHP_FUNCTION(pdf_moveto) | |
372 | { | |
373 | @@ -1232,7 +1257,7 @@ | |
374 | } | |
375 | /* }}} */ | |
376 | ||
377 | -/* {{{ proto void pdf_curveto(int pdfdoc, double x1, double y1, double x2, double y2, double x3, double y3) | |
378 | +/* {{{ proto void pdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3) | |
379 | Draws a curve */ | |
380 | PHP_FUNCTION(pdf_curveto) | |
381 | { | |
382 | @@ -1263,7 +1288,7 @@ | |
383 | } | |
384 | /* }}} */ | |
385 | ||
386 | -/* {{{ proto void pdf_lineto(int pdfdoc, double x, double y) | |
387 | +/* {{{ proto void pdf_lineto(int pdfdoc, float x, float y) | |
388 | Draws a line */ | |
389 | PHP_FUNCTION(pdf_lineto) | |
390 | { | |
391 | @@ -1283,7 +1308,7 @@ | |
392 | } | |
393 | /* }}} */ | |
394 | ||
395 | -/* {{{ proto void pdf_circle(int pdfdoc, double x, double y, double radius) | |
396 | +/* {{{ proto void pdf_circle(int pdfdoc, float x, float y, float radius) | |
397 | Draws a circle */ | |
398 | PHP_FUNCTION(pdf_circle) | |
399 | { | |
400 | @@ -1304,7 +1329,7 @@ | |
401 | } | |
402 | /* }}} */ | |
403 | ||
404 | -/* {{{ proto void pdf_arc(int pdfdoc, double x, double y, double radius, double start, double end) | |
405 | +/* {{{ proto void pdf_arc(int pdfdoc, float x, float y, float radius, float start, float end) | |
406 | Draws an arc */ | |
407 | PHP_FUNCTION(pdf_arc) | |
408 | { | |
409 | @@ -1333,7 +1358,7 @@ | |
410 | } | |
411 | /* }}} */ | |
412 | ||
413 | -/* {{{ proto void pdf_rect(int pdfdoc, double x, double y, double width, double height) | |
414 | +/* {{{ proto void pdf_rect(int pdfdoc, float x, float y, float width, float height) | |
415 | Draws a rectangle */ | |
416 | PHP_FUNCTION(pdf_rect) | |
417 | { | |
418 | @@ -1552,7 +1577,7 @@ | |
419 | } | |
420 | /* }}} */ | |
421 | ||
422 | -/* {{{ proto void pdf_setgray_fill(int pdfdoc, double value) | |
423 | +/* {{{ proto void pdf_setgray_fill(int pdfdoc, float value) | |
424 | Sets filling color to gray value */ | |
425 | PHP_FUNCTION(pdf_setgray_fill) | |
426 | { | |
427 | @@ -1575,7 +1600,7 @@ | |
428 | } | |
429 | /* }}} */ | |
430 | ||
431 | -/* {{{ proto void pdf_setgray_stroke(int pdfdoc, double value) | |
432 | +/* {{{ proto void pdf_setgray_stroke(int pdfdoc, float value) | |
433 | Sets drawing color to gray value */ | |
434 | PHP_FUNCTION(pdf_setgray_stroke) | |
435 | { | |
436 | @@ -1598,7 +1623,7 @@ | |
437 | } | |
438 | /* }}} */ | |
439 | ||
440 | -/* {{{ proto void pdf_setgray(int pdfdoc, double value) | |
441 | +/* {{{ proto void pdf_setgray(int pdfdoc, float value) | |
442 | Sets drawing and filling color to gray value */ | |
443 | PHP_FUNCTION(pdf_setgray) | |
444 | { | |
445 | @@ -1621,7 +1646,7 @@ | |
446 | } | |
447 | /* }}} */ | |
448 | ||
449 | -/* {{{ proto void pdf_setrgbcolor_fill(int pdfdoc, double red, double green, double blue) | |
450 | +/* {{{ proto void pdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue) | |
451 | Sets filling color to RGB color value */ | |
452 | PHP_FUNCTION(pdf_setrgbcolor_fill) | |
453 | { | |
454 | @@ -1646,7 +1671,7 @@ | |
455 | } | |
456 | /* }}} */ | |
457 | ||
458 | -/* {{{ proto void pdf_setrgbcolor_stroke(int pdfdoc, double red, double green, double blue) | |
459 | +/* {{{ proto void pdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue) | |
460 | Sets drawing color to RGB color value */ | |
461 | PHP_FUNCTION(pdf_setrgbcolor_stroke) | |
462 | { | |
463 | @@ -1671,7 +1696,7 @@ | |
464 | } | |
465 | /* }}} */ | |
466 | ||
467 | -/* {{{ proto void pdf_setrgbcolor(int pdfdoc, double red, double green, double blue) | |
468 | +/* {{{ proto void pdf_setrgbcolor(int pdfdoc, float red, float green, float blue) | |
469 | Sets drawing and filling color to RGB color value */ | |
470 | PHP_FUNCTION(pdf_setrgbcolor) | |
471 | { | |
472 | @@ -1798,7 +1823,7 @@ | |
473 | } | |
474 | /* }}} */ | |
475 | ||
476 | -/* {{{ proto void pdf_set_duration(int pdfdoc, double duration) | |
477 | +/* {{{ proto void pdf_set_duration(int pdfdoc, float duration) | |
478 | Sets duration between pages */ | |
479 | PHP_FUNCTION(pdf_set_duration) | |
480 | { | |
481 | @@ -1835,7 +1860,11 @@ | |
482 | convert_to_string_ex(arg2); | |
483 | ||
484 | #ifdef VIRTUAL_DIR | |
485 | +# if ZEND_MODULE_API_NO >= 20010901 | |
486 | virtual_filepath(Z_STRVAL_PP(arg2), &image TSRMLS_CC); | |
487 | +# else | |
488 | + virtual_filepath(Z_STRVAL_PP(arg2), &image); | |
489 | +# endif | |
490 | #else | |
491 | image = Z_STRVAL_PP(arg2); | |
492 | #endif | |
493 | @@ -1908,7 +1937,11 @@ | |
494 | convert_to_string_ex(arg3); | |
495 | ||
496 | #ifdef VIRTUAL_DIR | |
497 | +# if ZEND_MODULE_API_NO >= 20010901 | |
498 | virtual_filepath(Z_STRVAL_PP(arg3), &image TSRMLS_CC); | |
499 | +# else | |
500 | + virtual_filepath(Z_STRVAL_PP(arg3), &image); | |
501 | +# endif | |
502 | #else | |
503 | image = Z_STRVAL_PP(arg3); | |
504 | #endif | |
505 | @@ -2013,7 +2046,7 @@ | |
506 | } | |
507 | /* }}} */ | |
508 | ||
509 | -/* {{{ proto void pdf_place_image(int pdf, int pdfimage, double x, double y, double scale) | |
510 | +/* {{{ proto void pdf_place_image(int pdf, int pdfimage, float x, float y, float scale) | |
511 | Places image in the PDF document */ | |
512 | PHP_FUNCTION(pdf_place_image) | |
513 | { | |
514 | @@ -2076,7 +2109,7 @@ | |
515 | } | |
516 | /* }}} */ | |
517 | ||
518 | -/* {{{ proto void pdf_add_weblink(int pdfdoc, double llx, double lly, double urx, double ury, string url) | |
519 | +/* {{{ proto void pdf_add_weblink(int pdfdoc, float llx, float lly, float urx, float ury, string url) | |
520 | Adds link to web resource */ | |
521 | PHP_FUNCTION(pdf_add_weblink) | |
522 | { | |
523 | @@ -2103,7 +2136,7 @@ | |
524 | } | |
525 | /* }}} */ | |
526 | ||
527 | -/* {{{ proto void pdf_add_pdflink(int pdfdoc, double llx, double lly, double urx, double ury, string filename, int page, string dest) | |
528 | +/* {{{ proto void pdf_add_pdflink(int pdfdoc, float llx, float lly, float urx, float ury, string filename, int page, string dest) | |
529 | Adds link to PDF document */ | |
530 | PHP_FUNCTION(pdf_add_pdflink) | |
531 | { | |
532 | @@ -2135,7 +2168,7 @@ | |
533 | } | |
534 | /* }}} */ | |
535 | ||
536 | -/* {{{ proto void pdf_set_border_style(int pdfdoc, string style, double width) | |
537 | +/* {{{ proto void pdf_set_border_style(int pdfdoc, string style, float width) | |
538 | Sets style of box surounding all kinds of annotations and link */ | |
539 | PHP_FUNCTION(pdf_set_border_style) | |
540 | { | |
541 | @@ -2155,7 +2188,7 @@ | |
542 | } | |
543 | /* }}} */ | |
544 | ||
545 | -/* {{{ proto void pdf_set_border_color(int pdfdoc, double red, double green, double blue) | |
546 | +/* {{{ proto void pdf_set_border_color(int pdfdoc, float red, float green, float blue) | |
547 | Sets color of box surounded all kinds of annotations and links */ | |
548 | PHP_FUNCTION(pdf_set_border_color) | |
549 | { | |
550 | @@ -2176,7 +2209,7 @@ | |
551 | } | |
552 | /* }}} */ | |
553 | ||
554 | -/* {{{ proto void pdf_set_border_dash(int pdfdoc, double black, double white) | |
555 | +/* {{{ proto void pdf_set_border_dash(int pdfdoc, float black, float white) | |
556 | Sets the border dash style of all kinds of annotations and links */ | |
557 | PHP_FUNCTION(pdf_set_border_dash) | |
558 | { | |
559 | @@ -2196,7 +2229,7 @@ | |
560 | } | |
561 | /* }}} */ | |
562 | ||
563 | -/* {{{ proto void pdf_add_annotation(int pdfdoc, double xll, double yll, double xur, double xur, string title, string text) | |
564 | +/* {{{ proto void pdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text) | |
565 | Sets annotation (depreciated use pdf_add_note instead) */ | |
566 | PHP_FUNCTION(pdf_add_annotation) | |
567 | { | |
568 | @@ -2247,7 +2280,7 @@ | |
569 | ||
570 | /* }}} */ | |
571 | ||
572 | -/* {{{ proto void pdf_delete(int pdfdoc) | |
573 | +/* {{{ proto bool pdf_delete(int pdfdoc) | |
574 | Deletes the PDF object */ | |
575 | PHP_FUNCTION(pdf_delete) | |
576 | { | |
577 | @@ -2260,8 +2293,11 @@ | |
578 | ||
579 | ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); | |
580 | ||
581 | - PDF_delete(pdf); | |
582 | - zend_list_delete(Z_LVAL_PP(arg1)); | |
583 | +#ifndef Z_RESVAL /* for php 4.0.3pl1 */ | |
584 | +#define Z_RESVAL(zval) (zval).value.lval | |
585 | +#define Z_RESVAL_PP(zval_pp) Z_RESVAL(**zval_pp) | |
586 | +#endif | |
587 | + zend_list_delete(Z_RESVAL_PP(arg1)); | |
588 | ||
589 | RETURN_TRUE; | |
590 | } | |
591 | @@ -2406,7 +2442,7 @@ | |
592 | } | |
593 | /* }}} */ | |
594 | ||
595 | -/* {{{ proto void pdf_setpolydash(int pdfdoc, double darray) | |
596 | +/* {{{ proto void pdf_setpolydash(int pdfdoc, float darray) | |
597 | Sets more complicated dash pattern */ | |
598 | ||
599 | PHP_FUNCTION(pdf_setpolydash) | |
600 | @@ -2436,10 +2472,10 @@ | |
601 | ||
602 | zend_hash_get_current_data(array, (void **) &keydataptr); | |
603 | keydata = *keydataptr; | |
604 | - if (keydata->type == IS_DOUBLE) { | |
605 | - darray[i] = (float) keydata->value.dval; | |
606 | - } else if (keydata->type == IS_LONG) { | |
607 | - darray[i] = (float) keydata->value.lval; | |
608 | + if (Z_TYPE_P(keydata) == IS_DOUBLE) { | |
609 | + darray[i] = (float) Z_DVAL_P(keydata); | |
610 | + } else if (Z_TYPE_P(keydata) == IS_LONG) { | |
611 | + darray[i] = (float) Z_LVAL_P(keydata); | |
612 | } else { | |
613 | php_error(E_WARNING,"PDFlib set_polydash: illegal darray value"); | |
614 | } | |
615 | @@ -2453,7 +2489,7 @@ | |
616 | } | |
617 | /* }}} */ | |
618 | ||
619 | -/* {{{ proto void pdf_concat(int pdf, double a, double b, double c, double d, double e, double f) | |
620 | +/* {{{ proto void pdf_concat(int pdf, float a, float b, float c, float d, float e, float f) | |
621 | Concatenates a matrix to the current transformation matrix for text and graphics */ | |
622 | PHP_FUNCTION(pdf_concat) | |
623 | { | |
624 | @@ -2502,7 +2538,11 @@ | |
625 | ||
626 | convert_to_string_ex(arg2); | |
627 | #ifdef VIRTUAL_DIR | |
628 | +# if ZEND_MODULE_API_NO >= 20010901 | |
629 | virtual_filepath(Z_STRVAL_PP(arg2), &image TSRMLS_CC); | |
630 | +# else | |
631 | + virtual_filepath(Z_STRVAL_PP(arg2), &image); | |
632 | +# endif | |
633 | #else | |
634 | image = Z_STRVAL_PP(arg2); | |
635 | #endif | |
636 | @@ -2551,7 +2591,11 @@ | |
637 | convert_to_string_ex(arg10); | |
638 | ||
639 | #ifdef VIRTUAL_DIR | |
640 | +# if ZEND_MODULE_API_NO >= 20010901 | |
641 | virtual_filepath(Z_STRVAL_PP(arg4), &image TSRMLS_CC); | |
642 | +# else | |
643 | + virtual_filepath(Z_STRVAL_PP(arg4), &image); | |
644 | +# endif | |
645 | #else | |
646 | image = Z_STRVAL_PP(arg4); | |
647 | #endif | |
648 | @@ -2571,7 +2615,7 @@ | |
649 | } | |
650 | /* }}} */ | |
651 | ||
652 | -/* {{{ proto void pdf_attach_file(int pdf, double lly, double lly, double urx, double ury, string filename, string description, string author, string mimetype, string icon) | |
653 | +/* {{{ proto void pdf_attach_file(int pdf, float lly, float lly, float urx, float ury, string filename, string description, string author, string mimetype, string icon) | |
654 | Adds a file attachment annotation at the rectangle specified by his lower left and upper right corners */ | |
655 | PHP_FUNCTION(pdf_attach_file) | |
656 | { | |
657 | @@ -2609,7 +2653,7 @@ | |
658 | } | |
659 | /* }}} */ | |
660 | ||
661 | -/* {{{ proto void pdf_add_note(int pdfdoc, double llx, double lly, double urx, double ury, string contents, string title, string icon, int open) | |
662 | +/* {{{ proto void pdf_add_note(int pdfdoc, float llx, float lly, float urx, float ury, string contents, string title, string icon, int open) | |
663 | Sets annotation */ | |
664 | PHP_FUNCTION(pdf_add_note) | |
665 | { | |
666 | @@ -2645,7 +2689,7 @@ | |
667 | } | |
668 | /* }}} */ | |
669 | ||
670 | -/* {{{ proto void pdf_add_locallink(int pdfdoc, double llx, double lly, double urx, double ury, int page, string dest) | |
671 | +/* {{{ proto void pdf_add_locallink(int pdfdoc, float llx, float lly, float urx, float ury, int page, string dest) | |
672 | Adds link to web resource */ | |
673 | PHP_FUNCTION(pdf_add_locallink) | |
674 | { | |
675 | @@ -2677,7 +2721,7 @@ | |
676 | } | |
677 | /* }}} */ | |
678 | ||
679 | -/* {{{ proto void pdf_add_launchlink(int pdfdoc, double llx, double lly, double urx, double ury, string filename) | |
680 | +/* {{{ proto void pdf_add_launchlink(int pdfdoc, float llx, float lly, float urx, float ury, string filename) | |
681 | Adds link to web resource */ | |
682 | PHP_FUNCTION(pdf_add_launchlink) | |
683 | { | |
684 | @@ -2729,7 +2773,11 @@ | |
685 | convert_to_long_ex(arg4); | |
686 | ||
687 | #ifdef VIRTUAL_DIR | |
688 | +# if ZEND_MODULE_API_NO >= 20010901 | |
689 | virtual_filepath(Z_STRVAL_PP(arg2), &file TSRMLS_CC); | |
690 | +# else | |
691 | + virtual_filepath(Z_STRVAL_PP(arg2), &file); | |
692 | +# endif | |
693 | #else | |
694 | file = Z_STRVAL_PP(arg2); | |
695 | #endif | |
696 | @@ -2792,7 +2840,7 @@ | |
697 | } | |
698 | /* }}} */ | |
699 | ||
700 | -/* {{{ proto void pdf_place_pdi_page(int pdf, int page, double x, double y, double sx, double sy) | |
701 | +/* {{{ proto void pdf_place_pdi_page(int pdf, int page, float x, float y, float sx, float sy) | |
702 | * Place a PDF page with the lower left corner at (x, y), and scale it. */ | |
703 | PHP_FUNCTION(pdf_place_pdi_page) | |
704 | { | |
705 | @@ -2875,7 +2923,7 @@ | |
706 | } | |
707 | /* }}} */ | |
708 | ||
709 | -/* {{{ proto double pdf_get_pdi_value(int pdf, string key, int doc, int page, int index); | |
710 | +/* {{{ proto float pdf_get_pdi_value(int pdf, string key, int doc, int page, int index); | |
711 | * Get the contents of some PDI document parameter with numerical type. */ | |
712 | PHP_FUNCTION(pdf_get_pdi_value) | |
713 | { | |
714 | @@ -2904,7 +2952,7 @@ | |
715 | } | |
716 | /* }}} */ | |
717 | ||
718 | -/* {{{ proto int pdf_begin_pattern(int pdf, double width, double height, double xstep, double ystep, int painttype); | |
719 | +/* {{{ proto int pdf_begin_pattern(int pdf, float width, float height, float xstep, float ystep, int painttype); | |
720 | * Start a new pattern definition. */ | |
721 | PHP_FUNCTION(pdf_begin_pattern) | |
722 | { | |
723 | @@ -2954,7 +3002,7 @@ | |
724 | } | |
725 | /* }}} */ | |
726 | ||
727 | -/* {{{ proto int pdf_begin_template(int pdf, double width, double height); | |
728 | +/* {{{ proto int pdf_begin_template(int pdf, float width, float height); | |
729 | * Start a new template definition. */ | |
730 | PHP_FUNCTION(pdf_begin_template) | |
731 | { | |
732 | @@ -2999,7 +3047,7 @@ | |
733 | } | |
734 | /* }}} */ | |
735 | ||
736 | -/* {{{ proto void pdf_setcolor(int pdf, string type, string colorspace, double c1 [, double c2 [, double c3 [, double c4]]]); | |
737 | +/* {{{ proto void pdf_setcolor(int pdf, string type, string colorspace, float c1 [, float c2 [, float c3 [, float c4]]]); | |
738 | * Set the current color space and color. */ | |
739 | PHP_FUNCTION(pdf_setcolor) | |
740 | { | |
741 | @@ -3087,7 +3135,7 @@ | |
742 | } | |
743 | /* }}} */ | |
744 | ||
745 | -/* {{{ proto void pdf_arcn(int pdf, double x, double y, double r, double alpha, double beta); | |
746 | +/* {{{ proto void pdf_arcn(int pdf, float x, float y, float r, float alpha, float beta); | |
747 | * Draw a clockwise circular arc from alpha to beta degrees. */ | |
748 | PHP_FUNCTION(pdf_arcn) | |
749 | { | |
750 | @@ -3158,10 +3206,10 @@ | |
751 | } | |
752 | /* }}} */ | |
753 | ||
754 | -/* {{{ proto void pdf_setmatrix(int pdf, double a, double b, double c, double d, double e, double f) | |
755 | +/* {{{ proto void pdf_setmatrix(int pdf, float a, float b, float c, float d, float e, float f) | |
756 | Explicitly set the current transformation matrix. */ | |
757 | PHP_FUNCTION(pdf_setmatrix) | |
758 | -{ | |
759 | +{ | |
760 | zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7; | |
761 | PDF *pdf; | |
762 | ||
763 | @@ -3189,6 +3237,7 @@ | |
764 | RETURN_TRUE; | |
765 | } | |
766 | /* }}} */ | |
767 | + | |
768 | #endif /* PDFlib >= V4 */ | |
769 | ||
770 | #endif | |
771 | @@ -3198,6 +3247,6 @@ | |
772 | * tab-width: 4 | |
773 | * c-basic-offset: 4 | |
774 | * End: | |
775 | - * vim600: sw=4 ts=4 tw=78 fdm=marker | |
776 | - * vim<600: sw=4 ts=4 tw=78 | |
777 | + * vim600: sw=4 ts=4 fdm=marker | |
778 | + * vim<600: sw=4 ts=4 | |
779 | */ | |
780 | --- php-4.1.2/ext/pdf/php_pdf.h.wiget Tue Aug 7 19:26:32 2001 | |
781 | +++ php-4.1.2/ext/pdf/php_pdf.h Mon Dec 3 21:53:06 2001 | |
782 | @@ -16,17 +16,15 @@ | |
783 | +----------------------------------------------------------------------+ | |
784 | */ | |
785 | ||
786 | -/* $Id$ */ | |
787 | +/* $Id$ */ | |
788 | +/* Derived from: | |
789 | + Id: php_pdf.h,v 1.22 2001/11/30 04:46:35 sniper Exp */ | |
790 | ||
791 | #ifndef PHP_PDF_H | |
792 | #define PHP_PDF_H | |
793 | ||
794 | #if HAVE_PDFLIB | |
795 | ||
796 | -/* with version 2.20 of pdflib PDF_open_mem isn't available unless | |
797 | - the following define isn't there. | |
798 | -*/ | |
799 | -#define PDF_OPEN_MEM_SUPPORTED | |
800 | #include <pdflib.h> | |
801 | ||
802 | extern zend_module_entry pdf_module_entry; |