cvs: /php3/functions fdf.c php3_fdf.h

From: Date: Fri, 06 Aug 1999 06:35:53 +0000
Subject: cvs: /php3/functions fdf.c php3_fdf.h
Groups: php.dev 
Request: Send a blank email to php-dev+get-9589@lists.php.net to get a copy of this message
steinm Fri Aug 6 02:35:53 1999 EDT Modified files: /php3/functions fdf.c php3_fdf.h Log: New function fdf_add_template Some cleanups Index: php3/functions/fdf.c diff -u php3/functions/fdf.c:1.5 php3/functions/fdf.c:1.6 --- php3/functions/fdf.c:1.5 Wed Jun 16 07:34:18 1999 +++ php3/functions/fdf.c Fri Aug 6 02:35:52 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fdf.c,v 1.5 1999/06/16 11:34:18 ssb Exp $ */ +/* $Id: fdf.c,v 1.6 1999/08/06 06:35:52 steinm Exp $ */ /* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from http://beta1.adobe.com/ada/acrosdk/forms.html. */ @@ -41,7 +41,6 @@ #include "php.h" #include "internal_functions.h" #include "php3_list.h" -#include "head.h" #include <math.h> #include "php3_fdf.h" @@ -77,18 +76,19 @@ #endif function_entry fdf_functions[] = { - {"fdf_open", php3_fdf_open, NULL}, - {"fdf_create", php3_fdf_create, NULL}, - {"fdf_close", php3_fdf_close, NULL}, - {"fdf_save", php3_fdf_save, NULL}, - {"fdf_get_value", php3_fdf_get_value, NULL}, - {"fdf_set_value", php3_fdf_set_value, NULL}, - {"fdf_next_field_name", php3_fdf_next_field_name, NULL}, - {"fdf_set_ap", php3_fdf_set_ap, NULL}, - {"fdf_set_status", php3_fdf_set_status, NULL}, - {"fdf_get_status", php3_fdf_get_status, NULL}, - {"fdf_set_file", php3_fdf_set_file, NULL}, - {"fdf_get_file", php3_fdf_get_file, NULL}, + PHP_FE(fdf_open, NULL) + PHP_FE(fdf_create, NULL) + PHP_FE(fdf_close, NULL) + PHP_FE(fdf_save, NULL) + PHP_FE(fdf_get_value, NULL) + PHP_FE(fdf_set_value, NULL) + PHP_FE(fdf_next_field_name, NULL) + PHP_FE(fdf_set_ap, NULL) + PHP_FE(fdf_set_status, NULL) + PHP_FE(fdf_get_status, NULL) + PHP_FE(fdf_set_file, NULL) + PHP_FE(fdf_get_file, NULL) + PHP_FE(fdf_add_template, NULL) {NULL, NULL, NULL} }; @@ -130,7 +130,7 @@ /* {{{ proto int fdf_open(string filename) Opens a new fdf document */ -void php3_fdf_open(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_open) { pval *file; int id, type; FDFDoc fdf; @@ -156,7 +156,7 @@ /* {{{ proto void fdf_close(int fdfdoc) Closes the fdf document */ -void php3_fdf_close(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_close) { pval *arg1; int id, type; FDFDoc fdf; @@ -182,7 +182,7 @@ /* {{{ proto void fdf_create(void) Creates a new fdf document */ -void php3_fdf_create(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_create) { int id, type; FDFDoc fdf; FDFErc err; @@ -201,7 +201,7 @@ /* {{{ proto void fdf_get_value(int fdfdoc, string fieldname) Gets the value of a field as string */ -void php3_fdf_get_value(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_get_value) { pval *arg1, *arg2; int id, type; ASInt32 nr; @@ -238,7 +238,7 @@ /* {{{ proto void fdf_set_value(int fdfdoc, string fieldname, string value, int isName) Sets the value of a field */ -void php3_fdf_set_value(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_set_value) { pval *arg1, *arg2, *arg3, *arg4; int id, type; FDFDoc fdf; @@ -270,7 +270,7 @@ /* {{{ proto void fdf_next_field_name(int fdfdoc [, string fieldname]) Gets the name of the next field name or the first field name */ -void php3_fdf_next_field_name(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_next_field_name) { pval *argv[2]; int id, type, argc; ASInt32 nr; @@ -319,7 +319,7 @@ /* {{{ proto void fdf_set_ap(int fdfdoc, string fieldname, int face, string filename, int pagenr) Sets the value of a field */ -void php3_fdf_set_ap(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_set_ap) { pval *arg1, *arg2, *arg3, *arg4, *arg5; int id, type; FDFDoc fdf; @@ -367,7 +367,7 @@ /* {{{ proto void fdf_set_status(int fdfdoc, string status) Sets the value in the /Status key. */ -void php3_fdf_set_status(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_set_status) { pval *arg1, *arg2; int id, type; FDFDoc fdf; @@ -397,7 +397,7 @@ /* {{{ proto void fdf_get_status(int fdfdoc) Gets the value in the /Status key. */ -void php3_fdf_get_status(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_get_status) { pval *arg1; int id, type; ASInt32 nr; @@ -436,7 +436,7 @@ /* {{{ proto void fdf_set_file(int fdfdoc, string filename) Sets the value of the FDF's /F key */ -void php3_fdf_set_file(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_set_file) { pval *arg1, *arg2; int id, type; FDFDoc fdf; @@ -466,7 +466,7 @@ /* {{{ proto void fdf_get_file(int fdfdoc) Gets the value in the /F key. */ -void php3_fdf_get_file(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_get_file) { pval *arg1; int id, type; ASInt32 nr; @@ -505,7 +505,7 @@ /* {{{ proto void fdf_save(int fdfdoc, string filename) Writes out an FDF file. */ -void php3_fdf_save(INTERNAL_FUNCTION_PARAMETERS) { +PHP_FUNCTION(fdf_save) { pval *arg1, *arg2; int id, type; FDFDoc fdf; @@ -531,6 +531,48 @@ RETURN_TRUE; } /* }}} */ + +/* {{{ proto void fdf_add_template(int fdfdoc, int newpage, string filename, string template, int rename) + Adds a template to the FDF*/ +PHP_FUNCTION(fdf_add_template) { + pval *arg1, *arg2, *arg3, *arg4, *arg5; + int id, type; + FDFDoc fdf; + FDFErc err; + pdfFileSpecRec filespec; + FDF_TLS_VARS; + + if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + convert_to_long(arg2); + convert_to_string(arg3); + convert_to_string(arg4); + convert_to_long(arg5); + id=arg1->value.lval; + fdf = php3_list_find(id,&type); + if(!fdf || type!=FDF_GLOBAL(le_fdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + filespec.FS = NULL; + filespec.F = arg3->value.str.val; + filespec.Mac = NULL; + filespec.DOS = NULL; + filespec.Unix = NULL; + filespec.ID[0] = NULL; + filespec.ID[1] = NULL; + filespec.bVolatile = false; + err = FDFAddTemplate(fdf, arg2->value.lval, &filespec, arg4->value.str.val, arg5->value.lval); + if(err != FDFErcOK) + printf("Aiii, error\n"); + + RETURN_TRUE; +} +/* }}} */ #endif Index: php3/functions/php3_fdf.h diff -u php3/functions/php3_fdf.h:1.2 php3/functions/php3_fdf.h:1.3 --- php3/functions/php3_fdf.h:1.2 Fri Jan 1 12:59:15 1999 +++ php3/functions/php3_fdf.h Fri Aug 6 02:35:53 1999 @@ -26,7 +26,7 @@ | Authors: Uwe Steinmann | +----------------------------------------------------------------------+ */ -/* $Id: php3_fdf.h,v 1.2 1999/01/01 17:59:15 zeev Exp $ */ +/* $Id: php3_fdf.h,v 1.3 1999/08/06 06:35:53 steinm Exp $ */ #ifndef _PHP3_FDF_H #define _PHP3_FDF_H @@ -45,18 +45,19 @@ extern int php3_minit_fdf(INIT_FUNC_ARGS); extern int php3_mend_fdf(void); extern void php3_info_fdf(void); -extern void php3_fdf_open(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_close(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_create(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_save(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_get_value(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_set_value(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_next_field_name(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_set_ap(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_get_status(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_set_status(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_set_file(INTERNAL_FUNCTION_PARAMETERS); -extern void php3_fdf_get_file(INTERNAL_FUNCTION_PARAMETERS); +PHP_FUNCTION(fdf_open); +PHP_FUNCTION(fdf_close); +PHP_FUNCTION(fdf_create); +PHP_FUNCTION(fdf_save); +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_status); +PHP_FUNCTION(fdf_set_status); +PHP_FUNCTION(fdf_set_file); +PHP_FUNCTION(fdf_get_file); +PHP_FUNCTION(fdf_add_template); #else #define fdf_module_ptr NULL #endif

« previous php.dev (#9589) next »