Browse Source

@ updated FDF extension to work with current Adodeb fdftk 5.0 (hartmut)

reworked some existing stuff
added some functions suporting stuff that have been added since fdftk 2.0
emulating read from/save to strings by transparently using temp. files
  (activeX version of fdftk has this, but not plain C version :( )
experimental/threaded
Hartmut Holzgraefe 24 years ago
parent
commit
eb137d3d80
  1. 64
      ext/fdf/config.m4
  2. 979
      ext/fdf/fdf.c
  3. 32
      ext/fdf/php_fdf.h

64
ext/fdf/config.m4

@ -7,32 +7,68 @@ PHP_ARG_WITH(fdftk, for FDF support,
if test "$PHP_FDFTK" != "no"; then
for i in /usr /usr/local $PHP_FDFTK; do
if test -r $i/include/FdfTk.h; then
FDFTK_DIR=$i
elif test -r $i/include/fdftk.h; then
AC_DEFINE(HAVE_FDFTK_H_LOWER,1,[ ])
FDFTK_DIR=$i
fi
case $host_os in
aix*)
libtype=aix
;;
solaris* )
libtype=solaris
;;
linux*)
libtype=linux
;;
*)
AC_MSG_ERROR(sorry but the fdf tookkit is available for aix, solaris and linux only ... $host_os ... blame adboe)
;;
esac
if test "$PHP_FDFTK" = "yes"; then
PHP_FDFTK="/usr /usr/local ../FDFToolkitForUNIX ext/fdf/FDFToolkitForUNIX"
fi
for dir in $PHP_FDFTK; do
for subdir in include HeadersAndLibraries/headers; do
if test -r $dir/$subdir/FdfTk.h; then
FDFTK_DIR=$dir
FDFTK_H_DIR=$dir/$subdir
elif test -r $dir/$subdir/fdftk.h; then
AC_DEFINE(HAVE_FDFTK_H_LOWER,1,[ ])
FDFTK_DIR=$dir
FDFTK_H_DIR=$dir/$subdir
fi
done
done
if test -z "$FDFTK_DIR"; then
AC_MSG_ERROR(FdfTk.h or fdftk.h not found. Please reinstall the fdftk distribution.)
fi
PHP_ADD_INCLUDE($FDFTK_DIR/include)
PHP_ADD_INCLUDE($FDFTK_H_DIR)
FDFLIBRARY=""
for i in fdftk FdfTk; do
PHP_CHECK_LIBRARY($i, FDFOpen, [FDFLIBRARY=$i], [], [-L$FDFTK_DIR/lib -lm])
done
for file in fdftk FdfTk; do
for dir in $FDFTK_DIR/lib $FDFTK_DIR/HeadersAndLibraries/$libtype/C; do
echo testing $dir/lib$file.so
if test -r $dir/lib$file.so; then
if test -z "$FDFLIBRARY"; then
PHP_CHECK_LIBRARY($file, FDFOpen, [FDFLIBRARY=$file], [], [-L$dir -lm])
if test "$FDFLIBRARY"; then
echo ok
FDFTK_LIB_DIR=$dir
fi
fi
fi
done
done
if test -z "$FDFLIBRARY"; then
AC_MSG_ERROR(fdftk module requires >= fdftk 2.0)
AC_MSG_ERROR(no usable fdf library found)
fi
AC_DEFINE(HAVE_FDFLIB,1,[ ])
PHP_ADD_LIBRARY_WITH_PATH($FDFLIBRARY, $FDFTK_DIR/lib, FDFTK_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH($FDFLIBRARY, $FDFTK_LIB_DIR, FDFTK_SHARED_LIBADD)
PHP_SUBST(FDFTK_SHARED_LIBADD)
PHP_NEW_EXTENSION(fdf, fdf.c, $ext_shared)

979
ext/fdf/fdf.c
File diff suppressed because it is too large
View File

32
ext/fdf/php_fdf.h

@ -33,32 +33,62 @@
# include <FdfTk.h>
#endif
ZEND_BEGIN_MODULE_GLOBALS(fdf)
FDFErc error;
zval *enum_callback;
FDFDoc enum_fdf;
ZEND_END_MODULE_GLOBALS(fdf)
#ifdef ZTS
#define FDF_G(v) TSRMG(fdf_globals_id, zend_fdf_globals *, v)
#else
#define FDF_G(v) (fdf_globals.v)
#endif
extern zend_module_entry fdf_module_entry;
#define fdf_module_ptr &fdf_module_entry
PHP_MINIT_FUNCTION(fdf);
PHP_MSHUTDOWN_FUNCTION(fdf);
PHP_RINIT_FUNCTION(fdf);
PHP_MINFO_FUNCTION(fdf);
PHP_FUNCTION(fdf_open);
PHP_FUNCTION(fdf_open_string);
PHP_FUNCTION(fdf_close);
PHP_FUNCTION(fdf_create);
PHP_FUNCTION(fdf_save);
PHP_FUNCTION(fdf_save_string);
PHP_FUNCTION(fdf_get_value);
PHP_FUNCTION(fdf_set_value);
PHP_FUNCTION(fdf_next_field_name);
PHP_FUNCTION(fdf_set_ap);
PHP_FUNCTION(fdf_get_ap);
PHP_FUNCTION(fdf_get_status);
PHP_FUNCTION(fdf_set_status);
PHP_FUNCTION(fdf_set_file);
PHP_FUNCTION(fdf_get_file);
PHP_FUNCTION(fdf_add_template);
PHP_FUNCTION(fdf_set_flags);
PHP_FUNCTION(fdf_get_flags);
PHP_FUNCTION(fdf_set_opt);
PHP_FUNCTION(fdf_get_opt);
PHP_FUNCTION(fdf_set_submit_form_action);
PHP_FUNCTION(fdf_set_javascript_action);
PHP_FUNCTION(fdf_add_doc_javascript);
PHP_FUNCTION(fdf_set_on_import_javascript);
PHP_FUNCTION(fdf_set_encoding);
PHP_FUNCTION(fdf_get_encoding);
PHP_FUNCTION(fdf_set_version);
PHP_FUNCTION(fdf_get_version);
PHP_FUNCTION(fdf_set_target_frame);
PHP_FUNCTION(fdf_errno);
PHP_FUNCTION(fdf_error);
PHP_FUNCTION(fdf_remove_item);
PHP_FUNCTION(fdf_get_attachment);
PHP_FUNCTION(fdf_enum_values);
PHP_FUNCTION(fdf_header);
#else
#define fdf_module_ptr NULL
#endif

Loading…
Cancel
Save