CVS update: php3/functions

From: Date: Sun, 08 Nov 1998 21:12:41 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2285@lists.php.net to get a copy of this message
Date: Sunday November 8, 1998 @ 16:12 Author: rasmus Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv11111/functions Modified Files: basic_functions.c dir.c file.c gd.c Log Message: Many more prototype comments - these ones by Christine Index: php3/functions/basic_functions.c diff -c php3/functions/basic_functions.c:1.230 php3/functions/basic_functions.c:1.231 *** php3/functions/basic_functions.c:1.230 Thu Oct 22 04:05:57 1998 --- php3/functions/basic_functions.c Sun Nov 8 16:12:39 1998 *************** *** 1687,1693 **** } } ! PHP_FUNCTION(register_shutdown_function) { pval *arg, shutdown_function_name; --- 1687,1694 ---- } } ! /* {{{ proto void register_shutdown_function(string function_name) ! Register a user-level function to be called on request termination */ PHP_FUNCTION(register_shutdown_function) { pval *arg, shutdown_function_name; *************** *** 1706,1712 **** pval_copy_constructor(&shutdown_function_name); _php3_hash_next_index_insert(user_shutdown_function_names, &shutdown_function_name, sizeof(pval), NULL); ! } /* * Local variables: --- 1707,1713 ---- pval_copy_constructor(&shutdown_function_name); _php3_hash_next_index_insert(user_shutdown_function_names, &shutdown_function_name, sizeof(pval), NULL); ! } /* }}} */ /* * Local variables: Index: php3/functions/dir.c diff -c php3/functions/dir.c:1.53 php3/functions/dir.c:1.54 *** php3/functions/dir.c:1.53 Fri Aug 14 19:47:15 1998 --- php3/functions/dir.c Sun Nov 8 16:12:39 1998 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dir.c,v 1.53 1998/08/14 23:47:15 steffann Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dir.c,v 1.54 1998/11/08 21:12:39 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 109,114 **** --- 109,116 ---- RETURN_LONG(ret); } + /* {{{ proto void closedir([int dir_handle]) + Close directory connection identified by the dir_handle */ void php3_closedir(INTERNAL_FUNCTION_PARAMETERS) { pval *id, *tmp; *************** *** 140,147 **** RETURN_FALSE; } php3_list_delete(id_to_find); ! } void php3_chdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; --- 142,151 ---- RETURN_FALSE; } php3_list_delete(id_to_find); ! } /* }}} */ + /* {{{ proto int chdir(string directory) + Change the current directory */ void php3_chdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; *************** *** 159,166 **** RETURN_FALSE; } RETURN_TRUE; ! } void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS) { pval *id, *tmp; --- 163,172 ---- RETURN_FALSE; } RETURN_TRUE; ! } /* }}} */ + /* {{{ proto void rewinddir([int dir_handle]) + Rewind dir_handle back to the start */ void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS) { pval *id, *tmp; *************** *** 192,199 **** RETURN_FALSE; } rewinddir(dirp); ! } void php3_readdir(INTERNAL_FUNCTION_PARAMETERS) { pval *id, *tmp; --- 198,207 ---- RETURN_FALSE; } rewinddir(dirp); ! } /* }}} */ + /* {{{ proto string readdir([int dir_handle]) + Read directory entry from dir_handle */ void php3_readdir(INTERNAL_FUNCTION_PARAMETERS) { pval *id, *tmp; *************** *** 230,237 **** RETURN_STRINGL(direntp->d_name, strlen(direntp->d_name), 1); } RETURN_FALSE; ! } void php3_getdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; DIR *dirp; --- 238,247 ---- RETURN_STRINGL(direntp->d_name, strlen(direntp->d_name), 1); } RETURN_FALSE; ! } /* }}} */ + /* {{{ proto class dir(string directory) + Directory class with properties, handle and class and methods read, rewind and close */ void php3_getdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; DIR *dirp; *************** *** 261,267 **** add_method(return_value, "read", php3_readdir); add_method(return_value, "rewind", php3_rewinddir); add_method(return_value, "close", php3_closedir); ! } /* * Local variables: --- 271,277 ---- add_method(return_value, "read", php3_readdir); add_method(return_value, "rewind", php3_rewinddir); add_method(return_value, "close", php3_closedir); ! } /* }}} */ /* * Local variables: Index: php3/functions/file.c diff -c php3/functions/file.c:1.182 php3/functions/file.c:1.183 *** php3/functions/file.c:1.182 Sat Sep 19 16:17:16 1998 --- php3/functions/file.c Sun Nov 8 16:12:40 1998 *************** *** 26,32 **** | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: file.c,v 1.182 1998/09/19 20:17:16 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 26,32 ---- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: file.c,v 1.183 1998/11/08 21:12:40 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 214,219 **** --- 214,221 ---- The meta tag must have a name and content attribute, otherwise it will be skipped. The function stops parsing at the closing head tag. */ + /* {{{ proto array get_meta_tags(string filename [, int use_include_path]) + Extracts all meta tags from a file and returns an array */ void php3_get_meta_tags(INTERNAL_FUNCTION_PARAMETERS) { pval *filename, *arg2; FILE *fp; *************** *** 342,349 **** } else { fclose(fp); } ! } void php3_file(INTERNAL_FUNCTION_PARAMETERS) { pval *filename, *arg2; FILE *fp; --- 344,353 ---- } else { fclose(fp); } ! } /* }}} */ + /* {{{ proto array file(string filename) + Read entire file into an array */ void php3_file(INTERNAL_FUNCTION_PARAMETERS) { pval *filename, *arg2; FILE *fp; *************** *** 408,414 **** } else { fclose(fp); } ! } static void __pclose(FILE *pipe) --- 412,418 ---- } else { fclose(fp); } ! } /* }}} */ static void __pclose(FILE *pipe) *************** *** 446,452 **** return SUCCESS; } ! void php3_tempnam(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; char *d; --- 450,457 ---- return SUCCESS; } ! /* {{{ proto string tempnam(string dir, string prefix) ! Create a unique filename in a directory */ void php3_tempnam(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; char *d; *************** *** 465,472 **** t = tempnam(d,p); efree(d); RETURN_STRING(t,1); ! } void php3_fopen(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; FILE *fp; --- 470,479 ---- t = tempnam(d,p); efree(d); RETURN_STRING(t,1); ! } /* }}} */ + /* {{{ proto int fopen(string filename, string mode [, int use_include_path]) + Open a file or a URL and return a file pointer */ void php3_fopen(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; FILE *fp; *************** *** 521,528 **** } efree(p); RETURN_LONG(id); ! } void php3_fclose(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; --- 528,537 ---- } efree(p); RETURN_LONG(id); ! } /* }}} */ + /* {{{ proto int fclose(int fp) + Close an open file pointer */ void php3_fclose(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; *************** *** 541,548 **** } php3_list_delete(id); RETURN_TRUE; ! } void php3_popen(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; FILE *fp; --- 550,559 ---- } php3_list_delete(id); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int popen(string command, string mode) + Execute a command and open either a read or a write pipe to it */ void php3_popen(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; FILE *fp; *************** *** 589,596 **** id = php3_list_insert(fp,GLOBAL(le_pp)); efree(p); RETURN_LONG(id); ! } void php3_pclose(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id,type; --- 600,609 ---- id = php3_list_insert(fp,GLOBAL(le_pp)); efree(p); RETURN_LONG(id); ! } /* }}} */ + /* {{{ proto int pclose(int fp) + Close a file pointer opened by popen() */ void php3_pclose(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id,type; *************** *** 610,617 **** } php3_list_delete(id); RETURN_LONG(GLOBAL(pclose_ret)); ! } void php3_feof(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; FILE *fp; --- 623,632 ---- } php3_list_delete(id); RETURN_LONG(GLOBAL(pclose_ret)); ! } /* }}} */ + /* {{{ proto int feof(int fp) + Test for end-of-file on a file pointer */ void php3_feof(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; FILE *fp; *************** *** 642,649 **** } else { RETURN_FALSE; } ! } void php3_set_socket_blocking(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; --- 657,666 ---- } else { RETURN_FALSE; } ! } /* }}} */ + /* {{{ proto int set_socket_blocking(int socket descriptor, int mode) + Set blocking/non-blocking mode on a socket */ void php3_set_socket_blocking(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; *************** *** 701,707 **** fcntl(socketd,F_SETFL,flags); /* FIXME: Shouldnt we return true on this function? */ #endif ! } #if (0 && HAVE_SYS_TIME_H && HAVE_SETSOCKOPT && defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)) --- 718,724 ---- fcntl(socketd,F_SETFL,flags); /* FIXME: Shouldnt we return true on this function? */ #endif ! } /* }}} */ #if (0 && HAVE_SYS_TIME_H && HAVE_SETSOCKOPT && defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)) *************** *** 730,737 **** RETURN_TRUE; } #endif - void php3_fgets(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; --- 747,755 ---- RETURN_TRUE; } #endif + /* {{{ proto string fgets(int fp, int length) + Get a line from file pointer */ void php3_fgets(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; *************** *** 776,783 **** return_value->type = IS_STRING; } return; ! } void php3_fgetc(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; FILE *fp; --- 794,803 ---- return_value->type = IS_STRING; } return; ! } /* }}} */ + /* {{{ proto string fgetc(int fp) + Get a character from file pointer */ void php3_fgetc(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; FILE *fp; *************** *** 814,822 **** return_value->type = IS_STRING; } return; ! } /* Strip any HTML tags while reading */ void php3_fgetss(INTERNAL_FUNCTION_PARAMETERS) { pval *fd, *bytes; --- 834,844 ---- return_value->type = IS_STRING; } return; ! } /* }}} */ /* Strip any HTML tags while reading */ + /* {{{ proto string fgetss(int fp, int length) + Get a line from file pointer and strip HTML tags */ void php3_fgetss(INTERNAL_FUNCTION_PARAMETERS) { pval *fd, *bytes; *************** *** 936,944 **** efree(buf); RETVAL_STRING(rbuf,1); efree(rbuf); ! } ! void php3_fwrite(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3=NULL; --- 958,967 ---- efree(buf); RETVAL_STRING(rbuf,1); efree(rbuf); ! } /* }}} */ + /* {{{ proto int fwrite(int fp, string str [, int length]) + Binary-safe file write */ void php3_fwrite(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3=NULL; *************** *** 994,1002 **** ret = fwrite(arg2->value.str.val,1,num_bytes,fp); } RETURN_LONG(ret); ! } ! void php3_rewind(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id,type; --- 1017,1026 ---- ret = fwrite(arg2->value.str.val,1,num_bytes,fp); } RETURN_LONG(ret); ! } /* }}} */ ! /* {{{ proto int rewind(int fp) ! Rewind the position of a file pointer */ void php3_rewind(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id,type; *************** *** 1015,1022 **** } rewind(fp); RETURN_TRUE; ! } void php3_ftell(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; --- 1039,1048 ---- } rewind(fp); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int ftell(int fp) + Get file pointer's read/write position */ void php3_ftell(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; *************** *** 1036,1043 **** } pos = ftell(fp); RETURN_LONG(pos); ! } void php3_fseek(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int ret,id,type; --- 1062,1071 ---- } pos = ftell(fp); RETURN_LONG(pos); ! } /* }}} */ + /* {{{ proto int fseek(int fp, int offset) + Seek on a file pointer */ void php3_fseek(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int ret,id,type; *************** *** 1069,1076 **** ret = fseek(fp,pos,SEEK_SET); #endif RETURN_LONG(ret); ! } void php3_mkdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int ret,mode; --- 1097,1106 ---- ret = fseek(fp,pos,SEEK_SET); #endif RETURN_LONG(ret); ! } /* }}} */ + /* {{{ proto int mkdir(string pathname, int mode) + Create a directory */ void php3_mkdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int ret,mode; *************** *** 1091,1098 **** RETURN_FALSE; } RETURN_TRUE; ! } void php3_rmdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int ret; --- 1121,1130 ---- RETURN_FALSE; } RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int rmdir(string dirname) + Remove a directory */ void php3_rmdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int ret; *************** *** 1111,1121 **** RETURN_FALSE; } RETURN_TRUE; ! } ! /* ! * Read a file and write the ouput to stdout ! */ void php3_readfile(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; char buf[8192]; --- 1143,1152 ---- RETURN_FALSE; } RETURN_TRUE; ! } /* }}} */ ! /* {{{ proto int readfile(string filename [, int use_include_path]) ! Output a file or a URL */ void php3_readfile(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; char buf[8192]; *************** *** 1174,1184 **** fclose(fp); } RETURN_LONG(size); ! } ! /* ! * Return or change the umask. ! */ void php3_fileumask(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int oldumask; --- 1205,1214 ---- fclose(fp); } RETURN_LONG(size); ! } /* }}} */ ! /* {{{ proto int umask([int mask]) ! Return or change the umask */ void php3_fileumask(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int oldumask; *************** *** 1198,1208 **** umask(arg1->value.lval); } RETURN_LONG(oldumask); ! } /* * Read to EOF on a file descriptor and write the output to stdout. */ void php3_fpassthru(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; FILE *fp; --- 1228,1240 ---- umask(arg1->value.lval); } RETURN_LONG(oldumask); ! } /* }}} */ /* * Read to EOF on a file descriptor and write the output to stdout. */ + /* {{{ proto int fpassthru(int fp) + Output all remaining data from a file pointer */ void php3_fpassthru(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; FILE *fp; *************** *** 1247,1255 **** */ php3_list_delete(id); RETURN_LONG(size); ! } ! void php3_rename(INTERNAL_FUNCTION_PARAMETERS) { pval *OLD, *NEW; char *old, *new; --- 1279,1288 ---- */ php3_list_delete(id); RETURN_LONG(size); ! } /* }}} */ + /* {{{ proto int rename(string old_name, string new_name) + Rename a file */ void php3_rename(INTERNAL_FUNCTION_PARAMETERS) { pval *OLD, *NEW; char *old, *new; *************** *** 1278,1286 **** } RETVAL_TRUE; ! } ! void php3_file_copy(INTERNAL_FUNCTION_PARAMETERS) { pval *source, *target; --- 1311,1320 ---- } RETVAL_TRUE; ! } /* }}} */ + /* {{{ proto int copy(string source_file, string destination_file) + Copy a file */ void php3_file_copy(INTERNAL_FUNCTION_PARAMETERS) { pval *source, *target; *************** *** 1330,1338 **** close(fd_t); RETVAL_TRUE; ! } ! void php3_fread(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; --- 1364,1373 ---- close(fd_t); RETVAL_TRUE; ! } /* }}} */ + /* {{{ proto int fread(int fp, int length) + Binary-safe file read */ void php3_fread(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; *************** *** 1373,1379 **** return_value->value.str.val = _php3_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1); } return_value->type = IS_STRING; ! } /* --- 1408,1414 ---- return_value->value.str.val = _php3_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1); } return_value->type = IS_STRING; ! } /* }}} */ /* Index: php3/functions/gd.c diff -c php3/functions/gd.c:1.98 php3/functions/gd.c:1.99 *** php3/functions/gd.c:1.98 Thu Oct 22 15:01:00 1998 --- php3/functions/gd.c Sun Nov 8 16:12:40 1998 *************** *** 29,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: gd.c,v 1.98 1998/10/22 19:01:00 ssb Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ --- 29,35 ---- +----------------------------------------------------------------------+ */ ! /* $Id: gd.c,v 1.99 1998/11/08 21:12:40 rasmus Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ *************** *** 277,282 **** --- 277,284 ---- efree(fp); } + /* {{{ proto int imageloadfont(string filename) + Load a new font */ void php3_imageloadfont(INTERNAL_FUNCTION_PARAMETERS) { pval *file; int hdr_size = sizeof(gdFont) - sizeof(char *); *************** *** 354,361 **** ind = 5 + php3_list_insert(font, GD_GLOBAL(le_gd_font)); RETURN_LONG(ind); ! } void php3_imagecreate(INTERNAL_FUNCTION_PARAMETERS) { pval *x_size, *y_size; int ind; --- 356,365 ---- ind = 5 + php3_list_insert(font, GD_GLOBAL(le_gd_font)); RETURN_LONG(ind); ! } /* }}} */ + /* {{{ proto int imagecreate(int x_size, int y_size) + Create a new image */ void php3_imagecreate(INTERNAL_FUNCTION_PARAMETERS) { pval *x_size, *y_size; int ind; *************** *** 373,380 **** ind = php3_list_insert(im, GD_GLOBAL(le_gd)); RETURN_LONG(ind); ! } void php3_imagecreatefromgif (INTERNAL_FUNCTION_PARAMETERS) { pval *file; int ind; --- 377,386 ---- ind = php3_list_insert(im, GD_GLOBAL(le_gd)); RETURN_LONG(ind); ! } /* }}} */ + /* {{{ proto int imagecreatefromgif(string filename) + Create a new image from file or URL */ void php3_imagecreatefromgif (INTERNAL_FUNCTION_PARAMETERS) { pval *file; int ind; *************** *** 412,419 **** ind = php3_list_insert(im, GD_GLOBAL(le_gd)); RETURN_LONG(ind); ! } void php3_imagedestroy(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind; --- 418,427 ---- ind = php3_list_insert(im, GD_GLOBAL(le_gd)); RETURN_LONG(ind); ! } /* }}} */ + /* {{{ proto int imagedestroy(int im) + Destroy an image */ void php3_imagedestroy(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind; *************** *** 426,433 **** php3_list_delete(imgind->value.lval); RETURN_TRUE; ! } void php3_imagecolorallocate(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; --- 434,443 ---- php3_list_delete(imgind->value.lval); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int imagecolorallocate(int im, int red, int green, int blue) + Allocate a color for an image */ void php3_imagecolorallocate(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; *************** *** 458,466 **** } col = gdImageColorAllocate(im, r, g, b); RETURN_LONG(col); ! } /* im, x, y */ void php3_imagecolorat(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *x, *y; int ind, ind_type; --- 468,478 ---- } col = gdImageColorAllocate(im, r, g, b); RETURN_LONG(col); ! } /* }}} */ /* im, x, y */ + /* {{{ proto int imagecolorat(int im, int x, int y) + Get the index of the color of a pixel */ void php3_imagecolorat(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *x, *y; int ind, ind_type; *************** *** 492,499 **** else { RETURN_FALSE; } ! } void php3_imagecolorclosest(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; --- 504,513 ---- else { RETURN_FALSE; } ! } /* }}} */ + /* {{{ proto int imagecolorclosest(int im, int red, int green, int blue) + Get the index of the closest color to the specified color */ void php3_imagecolorclosest(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; *************** *** 524,531 **** } col = gdImageColorClosest(im, r, g, b); RETURN_LONG(col); ! } void php3_imagecolordeallocate(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *index; int ind, ind_type, col; --- 538,547 ---- } col = gdImageColorClosest(im, r, g, b); RETURN_LONG(col); ! } /* }}} */ + /* {{{ proto int imagecolordeallocate(int im, int index) + De-allocate a color for an image */ void php3_imagecolordeallocate(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *index; int ind, ind_type, col; *************** *** 555,562 **** php3_error(E_WARNING, "Color index out of range"); RETURN_FALSE; } ! } void php3_imagecolorresolve(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; --- 571,580 ---- php3_error(E_WARNING, "Color index out of range"); RETURN_FALSE; } ! } /* }}} */ + /* {{{ proto int imagecolorresolve(int im, int red, int green, int blue) + Get the index of the specified color or its closest possible alternative */ void php3_imagecolorresolve(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; *************** *** 587,594 **** } col = gdImageColorResolve(im, r, g, b); RETURN_LONG(col); ! } void php3_imagecolorexact(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; --- 605,614 ---- } col = gdImageColorResolve(im, r, g, b); RETURN_LONG(col); ! } /* }}} */ + /* {{{ proto int imagecolorexact(int im, int red, int green, int blue) + Get the index of the specified color */ void php3_imagecolorexact(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *red, *green, *blue; int ind, ind_type; *************** *** 619,626 **** } col = gdImageColorExact(im, r, g, b); RETURN_LONG(col); ! } void php3_imagecolorset(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *color, *red, *green, *blue; int ind, ind_type; --- 639,648 ---- } col = gdImageColorExact(im, r, g, b); RETURN_LONG(col); ! } /* }}} */ + /* {{{ proto int imagecolorset(int im, int col, int red, int green, int blue) + Set the color for the specified palette index */ void php3_imagecolorset(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *color, *red, *green, *blue; int ind, ind_type; *************** *** 658,665 **** else { RETURN_FALSE; } ! } void php3_imagecolorsforindex(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *index; int col, ind, ind_type; --- 680,689 ---- else { RETURN_FALSE; } ! } /* }}} */ + /* {{{ proto array imagecolorsforindex(int im, int col) + Get the colors for an index */ void php3_imagecolorsforindex(INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *index; int col, ind, ind_type; *************** *** 693,700 **** php3_error(E_WARNING, "Color index out of range"); RETURN_FALSE; } ! } void php3_imagegif (INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *file; gdImagePtr im; --- 717,726 ---- php3_error(E_WARNING, "Color index out of range"); RETURN_FALSE; } ! } /* }}} */ + /* {{{ proto int imagegif(int im, string filename) + Output image to browser or file */ void php3_imagegif (INTERNAL_FUNCTION_PARAMETERS) { pval *imgind, *file; gdImagePtr im; *************** *** 767,774 **** } RETURN_TRUE; ! } void php3_imagesetpixel(INTERNAL_FUNCTION_PARAMETERS) { pval *imarg, *xarg, *yarg, *colarg; gdImagePtr im; --- 793,802 ---- } RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int imagesetpixel(int im, int x, int y, int col) + Set a single pixel */ void php3_imagesetpixel(INTERNAL_FUNCTION_PARAMETERS) { pval *imarg, *xarg, *yarg, *colarg; gdImagePtr im; *************** *** 800,808 **** gdImageSetPixel(im,x,y,col); RETURN_TRUE; ! } /* im, x1, y1, x2, y2, col */ void php3_imageline(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; --- 828,838 ---- gdImageSetPixel(im,x,y,col); RETURN_TRUE; ! } /* }}} */ /* im, x1, y1, x2, y2, col */ + /* {{{ proto int imageline(int im, int x1, int y1, int x2, int y2, int col) + Draw a line */ void php3_imageline(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; *************** *** 837,844 **** gdImageLine(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } void php3_imagedashedline(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; --- 867,876 ---- gdImageLine(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int imagedashedline(int im, int x1, int y1, int x2, int y2, int col) + Draw a dashed line */ void php3_imagedashedline(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; *************** *** 872,880 **** gdImageDashedLine(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } /* im, x1, y1, x2, y2, col */ void php3_imagerectangle(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; --- 904,914 ---- gdImageDashedLine(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } /* }}} */ /* im, x1, y1, x2, y2, col */ + /* {{{ proto int imagerectangle(int im, int x1, int y1, int x2, int y2, int col) + Draw a rectangle */ void php3_imagerectangle(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; *************** *** 909,917 **** gdImageRectangle(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } /* im, x1, y1, x2, y2, col */ void php3_imagefilledrectangle(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; --- 943,953 ---- gdImageRectangle(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } /* }}} */ /* im, x1, y1, x2, y2, col */ + /* {{{ proto int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col) + Draw a filled rectangle */ void php3_imagefilledrectangle(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL, *X1, *Y1, *X2, *Y2; gdImagePtr im; *************** *** 946,953 **** gdImageFilledRectangle(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } void php3_imagearc(INTERNAL_FUNCTION_PARAMETERS) { pval *COL, *E, *ST, *H, *W, *CY, *CX, *IM; gdImagePtr im; --- 982,991 ---- gdImageFilledRectangle(im,x1,y1,x2,y2,col); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int imagearc(int im, int cx, int cy, int w, int h, int s, int e, int col) + Draw a partial ellipse */ void php3_imagearc(INTERNAL_FUNCTION_PARAMETERS) { pval *COL, *E, *ST, *H, *W, *CY, *CX, *IM; gdImagePtr im; *************** *** 986,994 **** gdImageArc(im,cx,cy,w,h,st,e,col); RETURN_TRUE; ! } /* im, x, y, border, col */ void php3_imagefilltoborder(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *X, *Y, *BORDER, *COL; gdImagePtr im; --- 1024,1034 ---- gdImageArc(im,cx,cy,w,h,st,e,col); RETURN_TRUE; ! } /* }}} */ /* im, x, y, border, col */ + /* {{{ proto int imagefilltoborder(int im, int x, int y, int border, int col) + Flood fill to specific color */ void php3_imagefilltoborder(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *X, *Y, *BORDER, *COL; gdImagePtr im; *************** *** 1021,1029 **** gdImageFillToBorder(im,x,y,border,col); RETURN_TRUE; ! } /* im, x, y, col */ void php3_imagefill(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *X, *Y, *COL; gdImagePtr im; --- 1061,1071 ---- gdImageFillToBorder(im,x,y,border,col); RETURN_TRUE; ! } /* }}} */ /* im, x, y, col */ + /* {{{ proto int imagefill(int im, int x, int y, int col) + Flood fill */ void php3_imagefill(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *X, *Y, *COL; gdImagePtr im; *************** *** 1054,1061 **** gdImageFill(im,x,y,col); RETURN_TRUE; ! } void php3_imagecolorstotal(INTERNAL_FUNCTION_PARAMETERS) { pval *IM; gdImagePtr im; --- 1096,1105 ---- gdImageFill(im,x,y,col); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int imagecolorstotal(int im) + Find out the number of colors in an image's palette */ void php3_imagecolorstotal(INTERNAL_FUNCTION_PARAMETERS) { pval *IM; gdImagePtr im; *************** *** 1074,1082 **** } RETURN_LONG(gdImageColorsTotal(im)); ! } /* im, col */ void php3_imagecolortransparent(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL = NULL; gdImagePtr im; --- 1118,1128 ---- } RETURN_LONG(gdImageColorsTotal(im)); ! } /* }}} */ /* im, col */ + /* {{{ proto int imagecolortransparent(int im [, int col]) + Define a color as transparent */ void php3_imagecolortransparent(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *COL = NULL; gdImagePtr im; *************** *** 1113,1121 **** } col = gdImageGetTransparent(im); RETURN_LONG(col); ! } /* im, interlace */ void php3_imageinterlace(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *INT = NULL; gdImagePtr im; --- 1159,1169 ---- } col = gdImageGetTransparent(im); RETURN_LONG(col); ! } /* }}} */ /* im, interlace */ + /* {{{ proto int imageinterlace(int im [, int interlace]) + Enable or disable interlace */ void php3_imageinterlace(INTERNAL_FUNCTION_PARAMETERS) { pval *IM, *INT = NULL; gdImagePtr im; *************** *** 1152,1158 **** } interlace = gdImageGetInterlaced(im); RETURN_LONG(interlace); ! } /* arg = 0 normal polygon arg = 1 filled polygon */ --- 1200,1206 ---- } interlace = gdImageGetInterlaced(im); RETURN_LONG(interlace); ! } /* }}} */ /* arg = 0 normal polygon arg = 1 filled polygon */ *************** *** 1239,1254 **** } void php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); ! } ! void php3_imagefilledpolygon(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); ! } static gdFontPtr _php3_find_gd_font(HashTable *list, int size) --- 1287,1305 ---- } + /* {{{ proto int imagepolygon(int im, array point, int num_points, int col) + Draw a polygon */ void php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); ! } /* }}} */ ! /* {{{ proto int imagefilledpolygon(int im, array point, int num_points, int col) ! Draw a filled polygon */ void php3_imagefilledpolygon(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); ! } /* }}} */ static gdFontPtr _php3_find_gd_font(HashTable *list, int size) *************** *** 1307,1322 **** } void php3_imagefontwidth(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); ! } ! void php3_imagefontheight(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); ! } /* workaround for a bug in gd 1.2 */ --- 1358,1376 ---- } + /* {{{ proto int imagefontwidth(int font) + Get font width */ void php3_imagefontwidth(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); ! } /* }}} */ ! /* {{{ proto int imagefontheight(int font) ! Get font height */ void php3_imagefontheight(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); ! } /* }}} */ /* workaround for a bug in gd 1.2 */ *************** *** 1421,1447 **** } RETURN_TRUE; } - void php3_imagechar(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); ! } ! void php3_imagecharup(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); ! } ! void php3_imagestring(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); ! } ! void php3_imagestringup(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); ! } void php3_imagecopy(INTERNAL_FUNCTION_PARAMETERS) { pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY; --- 1475,1507 ---- } RETURN_TRUE; } + /* {{{ proto int imagechar(int im, int font, int x, int y, string c, int col) + Draw a character */ void php3_imagechar(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); ! } /* }}} */ + /* {{{ proto int imagecharup(int im, int font, int x, int y, string c, int col) + Draw a character rotated 90 degrees counter-clockwise */ void php3_imagecharup(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); ! } /* }}} */ + /* {{{ proto int imagestring(int im, int font, int x, int y, string str, int col) + Draw a string horizontally */ void php3_imagestring(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); ! } /* }}} */ ! /* {{{ proto int imagestringup(int im, int font, int x, int y, string str, int col) ! Draw a string vertically - rotated 90 degrees counter-clockwise */ void php3_imagestringup(INTERNAL_FUNCTION_PARAMETERS) { _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); ! } /* }}} */ + /* {{{ proto int imagecopy(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int srcW, int srcH) + Copy part of an image */ void php3_imagecopy(INTERNAL_FUNCTION_PARAMETERS) { pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY; *************** *** 1487,1494 **** gdImageCopy(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH); RETURN_TRUE; ! } void php3_imagecopyresized(INTERNAL_FUNCTION_PARAMETERS) { pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY, *DW, *DH; --- 1547,1556 ---- gdImageCopy(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int imagecopyresized(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH); + Copy and resize part of an image */ void php3_imagecopyresized(INTERNAL_FUNCTION_PARAMETERS) { pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY, *DW, *DH; *************** *** 1539,1546 **** gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH); RETURN_TRUE; ! } void php3_imagesxfn(INTERNAL_FUNCTION_PARAMETERS) { pval *IM; --- 1601,1610 ---- gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH); RETURN_TRUE; ! } /* }}} */ + /* {{{ proto int imagesx(int im) + Get image width */ void php3_imagesxfn(INTERNAL_FUNCTION_PARAMETERS) { pval *IM; *************** *** 1559,1566 **** } RETURN_LONG(gdImageSX(im)); ! } void php3_imagesyfn(INTERNAL_FUNCTION_PARAMETERS) { pval *IM; --- 1623,1632 ---- } RETURN_LONG(gdImageSX(im)); ! } /* }}} */ + /* {{{ proto int imagesy(int im) + Get image height */ void php3_imagesyfn(INTERNAL_FUNCTION_PARAMETERS) { pval *IM; *************** *** 1579,1600 **** } RETURN_LONG(gdImageSY(im)); ! } #if HAVE_LIBTTF #define TTFTEXT_DRAW 0 #define TTFTEXT_BBOX 1 void php3_imagettfbbox(INTERNAL_FUNCTION_PARAMETERS) { php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX); ! } void php3_imagettftext(INTERNAL_FUNCTION_PARAMETERS) { php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW); ! } static void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode) --- 1645,1670 ---- } RETURN_LONG(gdImageSY(im)); ! } /* }}} */ #if HAVE_LIBTTF #define TTFTEXT_DRAW 0 #define TTFTEXT_BBOX 1 + /* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text) + Give the bounding box of a text using TypeType fonts */ void php3_imagettfbbox(INTERNAL_FUNCTION_PARAMETERS) { php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX); ! } /* }}} */ + /* {{{ proto array imagettftext(int im, int size, int angle, int x, int y, int col, string font_file, string text) + Write text to the image using a TrueType font */ void php3_imagettftext(INTERNAL_FUNCTION_PARAMETERS) { php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW); ! } /* }}} */ static void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode) -- 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 (#2285) next »