CVS update: php3/functions
| From: | steinm | Date: | Tue, 20 Oct 1998 12:40:23 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1918@lists.php.net to get a copy of this message | ||
Date: Tuesday October 20, 1998 @ 8:40
Author: steinm
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv21650/functions
Modified Files:
pdf.c php3_pdf.h
Log Message:
some bug fixes
Index: php3/functions/pdf.c
diff -c php3/functions/pdf.c:1.2 php3/functions/pdf.c:1.3
*** php3/functions/pdf.c:1.2 Mon Oct 19 13:53:02 1998
--- php3/functions/pdf.c Tue Oct 20 08:40:22 1998
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: pdf.c,v 1.2 1998/10/19 17:53:02 steinm Exp $ */
/* pdflib 0.4 is subject to the ALADDIN FREE PUBLIC LICENSE.
Copyright (C) 1997 Thomas Merz. */
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: pdf.c,v 1.3 1998/10/20 12:40:22 steinm Exp $ */
/* pdflib 0.4 is subject to the ALADDIN FREE PUBLIC LICENSE.
Copyright (C) 1997 Thomas Merz. */
***************
*** 80,85 ****
--- 80,90 ----
function_entry pdf_functions[] = {
{"pdf_get_info", php3_pdf_get_info, NULL},
+ {"pdf_set_info_creator", php3_pdf_set_info_creator, NULL},
+ {"pdf_set_info_title", php3_pdf_set_info_title, NULL},
+ {"pdf_set_info_subject", php3_pdf_set_info_subject, NULL},
+ {"pdf_set_info_author", php3_pdf_set_info_author, NULL},
+ {"pdf_set_info_keywords", php3_pdf_set_info_keywords, NULL},
{"pdf_open", php3_pdf_open, NULL},
{"pdf_close", php3_pdf_close, NULL},
{"pdf_begin_page", php3_pdf_begin_page, NULL},
***************
*** 93,98 ****
--- 98,105 ----
{"pdf_set_text_rise", php3_pdf_set_text_rise, NULL},
// {"pdf_set_text_matrix", php3_pdf_set_text_matrix, NULL},
{"pdf_set_text_pos", php3_pdf_set_text_pos, NULL},
+ {"pdf_set_char_spacing", php3_pdf_set_char_spacing, NULL},
+ {"pdf_set_word_spacing", php3_pdf_set_word_spacing, NULL},
{"pdf_continue_text", php3_pdf_continue_text, NULL},
{"pdf_stringwidth", php3_pdf_stringwidth, NULL},
{"pdf_save", php3_pdf_save, NULL},
***************
*** 120,125 ****
--- 127,138 ----
{"pdf_closepath_fill_stroke", php3_pdf_closepath_fill_stroke, NULL},
{"pdf_endpath", php3_pdf_endpath, NULL},
{"pdf_clip", php3_pdf_clip, NULL},
+ {"pdf_setgray_fill", php3_pdf_setgray_fill, NULL},
+ {"pdf_setgray_stroke", php3_pdf_setgray_stroke, NULL},
+ {"pdf_setgray", php3_pdf_setgray, NULL},
+ {"pdf_setrgbcolor_fill", php3_pdf_setrgbcolor_fill, NULL},
+ {"pdf_setrgbcolor_stroke", php3_pdf_setrgbcolor_stroke,NULL},
+ {"pdf_setrgbcolor", php3_pdf_setrgbcolor, NULL},
{NULL, NULL, NULL}
};
***************
*** 158,165 ****
return 1;
}
#endif
- #endif
int php3_minit_pdf(INIT_FUNC_ARGS)
{
--- 171,185 ----
return 1;
}
#endif
+ void _free_pdf_info(PDF_info *info)
+ {
+ if(info->Title) efree(info->Title);
+ if(info->Subject) efree(info->Subject);
+ if(info->Author) efree(info->Author);
+ if(info->Keywords) efree(info->Keywords);
+ if(info->Creator) efree(info->Creator);
+ }
int php3_minit_pdf(INIT_FUNC_ARGS)
{
***************
*** 180,186 ****
TlsSetValue(PDFlibTls, (void *) pdflib_globals);
#endif
! PDF_GLOBAL(le_pdf_info) = register_list_destructors(php3_pdf_close, NULL);
PDF_GLOBAL(le_pdf) = register_list_destructors(php3_pdf_close, NULL);
return SUCCESS;
}
--- 200,206 ----
TlsSetValue(PDFlibTls, (void *) pdflib_globals);
#endif
! PDF_GLOBAL(le_pdf_info) = register_list_destructors(_free_pdf_info, NULL);
PDF_GLOBAL(le_pdf) = register_list_destructors(php3_pdf_close, NULL);
return SUCCESS;
}
***************
*** 226,231 ****
--- 246,381 ----
RETURN_LONG(id);
}
+ void php3_pdf_set_info_creator(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF_info *pdf_info;
+ PDF *pdf;
+ PDF_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_info = php3_list_find(id,&type);
+ if (!pdf_info || type!=PDF_GLOBAL(le_pdf_info)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type);
+ RETURN_FALSE;
+ }
+
+ pdf_info->Creator = estrdup(arg2->value.str.val);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_set_info_title(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF_info *pdf_info;
+ PDF *pdf;
+ PDF_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_info = php3_list_find(id,&type);
+ if (!pdf_info || type!=PDF_GLOBAL(le_pdf_info)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type);
+ RETURN_FALSE;
+ }
+
+ pdf_info->Title = estrdup(arg2->value.str.val);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_set_info_subject(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF_info *pdf_info;
+ PDF *pdf;
+ PDF_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_info = php3_list_find(id,&type);
+ if (!pdf_info || type!=PDF_GLOBAL(le_pdf_info)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type);
+ RETURN_FALSE;
+ }
+
+ pdf_info->Subject = estrdup(arg2->value.str.val);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_set_info_author(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF_info *pdf_info;
+ PDF *pdf;
+ PDF_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_info = php3_list_find(id,&type);
+ if (!pdf_info || type!=PDF_GLOBAL(le_pdf_info)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type);
+ RETURN_FALSE;
+ }
+
+ pdf_info->Author = estrdup(arg2->value.str.val);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_set_info_keywords(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF_info *pdf_info;
+ PDF *pdf;
+ PDF_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_info = php3_list_find(id,&type);
+ if (!pdf_info || type!=PDF_GLOBAL(le_pdf_info)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type);
+ RETURN_FALSE;
+ }
+
+ pdf_info->Keywords = estrdup(arg2->value.str.val);
+
+ RETURN_TRUE;
+ }
+
void php3_pdf_open(INTERNAL_FUNCTION_PARAMETERS) {
pval *file;
pval *info;
***************
*** 540,547 ****
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
! PDF_show_xy(pdf, arg2->value.str.val, (float) arg2->value.dval, (float)
arg3->value.dval);
RETURN_TRUE;
}
--- 690,745 ----
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
+
+ PDF_set_text_pos(pdf, (float) arg2->value.dval, (float) arg3->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_set_char_spacing(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ PDF_set_char_spacing(pdf, (float) arg2->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_set_word_spacing(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
! PDF_set_word_spacing(pdf, (float) arg2->value.dval);
RETURN_TRUE;
}
***************
*** 1214,1219 ****
--- 1412,1562 ----
RETURN_TRUE;
}
+ void php3_pdf_setgray_fill(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ PDF_setgray_fill(pdf, (float) arg2->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_setgray_stroke(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ PDF_setgray_stroke(pdf, (float) arg2->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_setgray(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ PDF_setgray(pdf, (float) arg2->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_setrgbcolor_fill(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2, *arg3, *arg4;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) ==
FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ PDF_setrgbcolor_fill(pdf, (float) arg2->value.dval, (float) arg3->value.dval, (float)
arg4->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_setrgbcolor_stroke(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2, *arg3, *arg4;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) ==
FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ PDF_setrgbcolor_stroke(pdf, (float) arg2->value.dval, (float) arg3->value.dval, (float)
arg4->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ void php3_pdf_setrgbcolor(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2, *arg3, *arg4;
+ int id, type;
+ PDF *pdf;
+ PDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) ==
FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_double(arg2);
+ id=arg1->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=PDF_GLOBAL(le_pdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ PDF_setrgbcolor(pdf, (float) arg2->value.dval, (float) arg3->value.dval, (float)
arg4->value.dval);
+
+ RETURN_TRUE;
+ }
+
+ #endif
/*
* Local variables:
Index: php3/functions/php3_pdf.h
diff -c php3/functions/php3_pdf.h:1.2 php3/functions/php3_pdf.h:1.3
*** php3/functions/php3_pdf.h:1.2 Mon Oct 19 13:53:02 1998
--- php3/functions/php3_pdf.h Tue Oct 20 08:40:22 1998
***************
*** 26,32 ****
| Authors: Uwe Steinmann |
+----------------------------------------------------------------------+
*/
! /* $Id: php3_pdf.h,v 1.2 1998/10/19 17:53:02 steinm Exp $ */
#ifndef _PHP3_PDF_H
#define _PHP3_PDF_H
--- 26,32 ----
| Authors: Uwe Steinmann |
+----------------------------------------------------------------------+
*/
! /* $Id: php3_pdf.h,v 1.3 1998/10/20 12:40:22 steinm Exp $ */
#ifndef _PHP3_PDF_H
#define _PHP3_PDF_H
***************
*** 44,49 ****
--- 44,54 ----
extern int php3_minit_pdf(INIT_FUNC_ARGS);
extern int php3_mend_pdf(void);
extern void php3_pdf_get_info(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_set_info_creator(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_set_info_title(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_set_info_subject(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_set_info_author(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_set_info_keywords(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_open(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_close(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_begin_page(INTERNAL_FUNCTION_PARAMETERS);
***************
*** 56,61 ****
--- 61,68 ----
extern void php3_pdf_set_horiz_scaling(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_set_text_rise(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_set_text_pos(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_set_char_spacing(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_set_word_spacing(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_continue_text(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_stringwidth(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_save(INTERNAL_FUNCTION_PARAMETERS);
***************
*** 83,88 ****
--- 90,101 ----
extern void php3_pdf_closepath_fill_stroke(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_endpath(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pdf_clip(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_setgray_fill(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_setgray_stroke(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_setgray(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_setrgbcolor_fill(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_setrgbcolor_stroke(INTERNAL_FUNCTION_PARAMETERS);
+ extern void php3_pdf_setrgbcolor(INTERNAL_FUNCTION_PARAMETERS);
#else
#define pdf_module_ptr NULL
#endif
--
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