CVS update: php3/functions

From: Date: Thu, 27 May 1999 15:00:51 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-6079@lists.php.net to get a copy of this message
Date: Thursday May 27, 1999 @ 11:00 Author: steinm Update of /repository/php3/functions In directory php:/tmp/cvs-serv5674/functions Modified Files: cpdf.c pgsql.c php3_cpdf.h php3_dav.h Log Message: - more function in cpdf module (adding hyperlinks, annotation, outline) - advanced test script for cpdf - change to pgsql.c and php3_dav.h just beatifying Index: php3/functions/cpdf.c diff -u php3/functions/cpdf.c:1.5 php3/functions/cpdf.c:1.6 --- php3/functions/cpdf.c:1.5 Wed May 26 15:40:29 1999 +++ php3/functions/cpdf.c Thu May 27 11:00:50 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cpdf.c,v 1.5 1999/05/26 19:40:29 steinm Exp $ */ +/* $Id: cpdf.c,v 1.6 1999/05/27 15:00:50 steinm Exp $ */ /* cpdflib.h -- C language API definitions for ClibPDF library * Copyright (C) 1998 FastIO Systems, All Rights Reserved. */ @@ -64,6 +64,7 @@ typedef struct cpdflib_global_struct{ int le_cpdf; + int le_outline; } cpdflib_global_struct; # define CPDF_GLOBAL(a) cpdflib_globals->a @@ -73,6 +74,7 @@ # define CPDF_GLOBAL(a) a # define CPDF_TLS_VARS int le_cpdf; +CPDFoutlineEntry *le_outline; #endif function_entry cpdf_functions[] = { @@ -138,11 +140,13 @@ {"cpdf_save_to_file", php3_cpdf_save_to_file, NULL}, {"cpdf_import_jpeg", php3_cpdf_import_jpeg, NULL}, {"cpdf_set_annotation", php3_cpdf_set_annotation, NULL}, + {"cpdf_add_outline", php3_cpdf_add_outline, NULL}, + {"cpdf_set_action_url", php3_cpdf_set_action_url, NULL}, {NULL, NULL, NULL} }; php3_module_entry cpdf_module_entry = { - "cpdf", cpdf_functions, php3_minit_cpdf, php3_mend_cpdf, NULL, NULL, php3_info_cpdf, STANDARD_MODULE_PROPERTIES + "cpdf", cpdf_functions, php3_minit_cpdf, php3_mend_cpdf, php3_rinit_cpdf, NULL, php3_info_cpdf, STANDARD_MODULE_PROPERTIES }; #if COMPILE_DL @@ -150,8 +154,19 @@ DLEXPORT php3_module_entry *get_module(void) { return &cpdf_module_entry; } #endif +static void _free_outline(CPDFoutlineEntry *outline) +{ +} + int php3_minit_cpdf(INIT_FUNC_ARGS) { + CPDF_GLOBAL(le_outline) = register_list_destructors(_free_outline, NULL); + return SUCCESS; +} + +int php3_rinit_cpdf(INIT_FUNC_ARGS) +{ +/* CPDF_GLOBAL(le_outline) = NULL; */ return SUCCESS; } @@ -360,16 +375,10 @@ CPDF_TLS_VARS; argc = ARG_COUNT(ht); - switch(argc) { - case 5: - case 6: - if (getParametersArray(ht, argc, argv) == FAILURE) - WRONG_PARAM_COUNT; - break; - default: - WRONG_PARAM_COUNT; - break; - } + if(argc < 5 || argc < 6) + WRONG_PARAM_COUNT; + if (getParametersArray(ht, argc, argv) == FAILURE) + WRONG_PARAM_COUNT; convert_to_long(argv[0]); convert_to_long(argv[1]); @@ -387,12 +396,13 @@ RETURN_FALSE; } - sprintf(buffer, "0 0 %d %d", width, height); - cpdf_pageInit(pagenr, orientation, buffer, buffer); if(argc > 5) { convert_to_double(argv[5]); - cpdf_setDefaultDomainUnit(argv[5]->value.dval); + if(argv[5]->value.dval > 0.0) + cpdf_setDefaultDomainUnit(argv[5]->value.dval); } + sprintf(buffer, "0 0 %d %d", width, height); + cpdf_pageInit(pagenr, orientation, buffer, buffer); RETURN_TRUE; } @@ -1994,32 +2004,6 @@ } /* }}} */ -/* {{{ proto void cpdf_add_outline(int pdfdoc, string text); - Add bookmark for current page */ -void php3_cpdf_add_outline(INTERNAL_FUNCTION_PARAMETERS) { - pval *arg1, *arg2; - int id, type; - int *pdf; - CPDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - - RETURN_TRUE; -} -/* }}} */ - /* {{{ proto void cpdf_set_transition(int pdfdoc, int transition, double duration, double direction, int orientation, int inout) Sets transition between pages */ void php3_cpdf_set_transition(INTERNAL_FUNCTION_PARAMETERS) { @@ -2237,7 +2221,7 @@ attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY; attrib.border_array = "[0 0 1 [4 2]]"; attrib.BS = NULL; - attrib.r = 1.00; + attrib.r = 0.00; attrib.g = 1.00; attrib.b = 1.00; if(argc > 7) { @@ -2262,6 +2246,111 @@ &attrib); RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto void cpdf_set_action_url(int pdfdoc, double xll, double yll, double xur, double xur, string url[, int mode]) + Sets Hyperlink */ +void php3_cpdf_set_action_url(INTERNAL_FUNCTION_PARAMETERS) { + pval *argv[11]; + int id, type, argc, mode=0; + int *pdf; + CPDFannotAttrib attrib; + CPDF_TLS_VARS; + + argc = ARG_COUNT(ht); + if((argc < 6) || (argc > 7)) + WRONG_PARAM_COUNT; + if (getParametersArray(ht, argc, argv) == FAILURE) + WRONG_PARAM_COUNT; + + convert_to_long(argv[0]); + convert_to_double(argv[1]); + convert_to_double(argv[2]); + convert_to_double(argv[3]); + convert_to_double(argv[4]); + convert_to_string(argv[5]); + id=argv[0]->value.lval; + pdf = php3_list_find(id,&type); + if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY; + attrib.border_array = "[0 0 1 [4 0]]"; + attrib.BS = NULL; + attrib.r = 0.00; + attrib.g = 0.00; + attrib.b = 1.00; + if(argc > 6) { + convert_to_long(argv[6]); + mode = argv[6]->value.lval; + } + if(mode == 1) + cpdf_rawSetActionURL((float) argv[1]->value.dval, + (float) argv[2]->value.dval, + (float) argv[3]->value.dval, + (float) argv[4]->value.dval, + argv[5]->value.str.val, + &attrib); + else + cpdf_setActionURL((float) argv[1]->value.dval, + (float) argv[2]->value.dval, + (float) argv[3]->value.dval, + (float) argv[4]->value.dval, + argv[5]->value.str.val, + &attrib); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int cpdf_add_outline(int pdfdoc, int lastoutline, int sublevel, int open, int pagenr, string title) + Add outline */ +void php3_cpdf_add_outline(INTERNAL_FUNCTION_PARAMETERS) { + pval *argv[11]; + int id, oid, type, argc, mode=0; + int *pdf; + CPDFoutlineEntry *lastoutline; + CPDF_TLS_VARS; + + argc = ARG_COUNT(ht); + if(argc != 6) + WRONG_PARAM_COUNT; + if (getParametersArray(ht, argc, argv) == FAILURE) + WRONG_PARAM_COUNT; + + convert_to_long(argv[0]); + convert_to_long(argv[1]); + convert_to_long(argv[2]); + convert_to_long(argv[3]); + convert_to_long(argv[4]); + convert_to_string(argv[5]); + id=argv[0]->value.lval; + pdf = php3_list_find(id,&type); + if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + oid=argv[1]->value.lval; + lastoutline = php3_list_find(oid,&type); + if(!lastoutline || type!=CPDF_GLOBAL(le_outline)) { + lastoutline = NULL; +/* php3_error(E_WARNING,"Unable to find last outline entry %d",id); + RETURN_FALSE; */ + } + + lastoutline = cpdf_addOutlineEntry(lastoutline, + argv[2]->value.lval, + argv[3]->value.lval, + argv[4]->value.lval, + argv[5]->value.str.val, + 1, 0.0, 0.0, 0.0, 0.0); + + id = php3_list_insert(lastoutline,CPDF_GLOBAL(le_outline)); + RETURN_LONG(id); } /* }}} */ Index: php3/functions/pgsql.c diff -u php3/functions/pgsql.c:1.83 php3/functions/pgsql.c:1.84 --- php3/functions/pgsql.c:1.83 Sat May 8 17:46:52 1999 +++ php3/functions/pgsql.c Thu May 27 11:00:50 1999 @@ -28,7 +28,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.83 1999/05/08 21:46:52 jah Exp $ */ +/* $Id: pgsql.c,v 1.84 1999/05/27 15:00:50 steinm Exp $ */ #include <stdlib.h> @@ -380,7 +380,7 @@ } /* }}} */ -/* {{{ proto int pg_pconnect([string connection_string] | [string host, string port, [string options, [string tty,]] string database) +/* {{{ proto int pg_pconnect([string connection_string] | [string host, string port, [string options, [string tty,]] string database]) Open a persistent PostgreSQL connection */ void php3_pgsql_pconnect(INTERNAL_FUNCTION_PARAMETERS) { Index: php3/functions/php3_cpdf.h diff -u php3/functions/php3_cpdf.h:1.4 php3/functions/php3_cpdf.h:1.5 --- php3/functions/php3_cpdf.h:1.4 Wed May 26 15:03:32 1999 +++ php3/functions/php3_cpdf.h Thu May 27 11:00:50 1999 @@ -26,7 +26,7 @@ | Authors: Uwe Steinmann | +----------------------------------------------------------------------+ */ -/* $Id: php3_cpdf.h,v 1.4 1999/05/26 19:03:32 steinm Exp $ */ +/* $Id: php3_cpdf.h,v 1.5 1999/05/27 15:00:50 steinm Exp $ */ #ifndef _PHP3_CPDF_H #define _PHP3_CPDF_H @@ -40,6 +40,7 @@ extern void php3_info_cpdf(void); extern int php3_minit_cpdf(INIT_FUNC_ARGS); +extern int php3_rinit_cpdf(INIT_FUNC_ARGS); extern int php3_mend_cpdf(void); extern void php3_cpdf_set_creator(INTERNAL_FUNCTION_PARAMETERS); extern void php3_cpdf_set_title(INTERNAL_FUNCTION_PARAMETERS); @@ -107,6 +108,7 @@ extern void php3_cpdf_save_to_file(INTERNAL_FUNCTION_PARAMETERS); extern void php3_cpdf_set_annotation(INTERNAL_FUNCTION_PARAMETERS); extern void php3_cpdf_import_jpeg(INTERNAL_FUNCTION_PARAMETERS); +extern void php3_cpdf_set_action_url(INTERNAL_FUNCTION_PARAMETERS); #else #define cpdf_module_ptr NULL #endif Index: php3/functions/php3_dav.h diff -u php3/functions/php3_dav.h:1.3 php3/functions/php3_dav.h:1.4 --- php3/functions/php3_dav.h:1.3 Thu Apr 22 09:19:50 1999 +++ php3/functions/php3_dav.h Thu May 27 11:00:50 1999 @@ -43,7 +43,7 @@ extern php3_module_entry phpdav_module_entry; # define phpdav_module_ptr &phpdav_module_entry -int phpdav_mkcol_test_handler(request_rec *); +int phpdav_mkcol_test_handler(request_rec *r); PHP_FUNCTION(dav_set_mkcol_handlers); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#6079) next »