CVS update: php3/functions
| From: | rasmus | Date: | Sat, 07 Nov 1998 15:56:20 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2275@lists.php.net to get a copy of this message | ||
Date: Saturday November 7, 1998 @ 10:56
Author: rasmus
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv9230/functions
Modified Files:
base64.c string.c
Log Message:
More prototype comments
Index: php3/functions/base64.c
diff -c php3/functions/base64.c:1.23 php3/functions/base64.c:1.24
*** php3/functions/base64.c:1.23 Sat Oct 10 19:55:41 1998
--- php3/functions/base64.c Sat Nov 7 10:56:19 1998
***************
*** 26,32 ****
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: base64.c,v 1.23 1998/10/10 23:55:41 jim Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 26,32 ----
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: base64.c,v 1.24 1998/11/07 15:56:19 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 142,147 ****
--- 142,149 ----
return result;
}
+ /* {{{ proto string base64_encode(string str)
+ Encodes string using MIME base64 algorithm */
void php3_base64_encode(INTERNAL_FUNCTION_PARAMETERS) {
pval *string;
unsigned char *result;
***************
*** 160,167 ****
} else {
RETURN_FALSE;
}
! }
void php3_base64_decode(INTERNAL_FUNCTION_PARAMETERS) {
pval *string;
unsigned char *result;
--- 162,172 ----
} else {
RETURN_FALSE;
}
! } /* }}} */
!
+ /* {{{ proto string base64_decode(string str)
+ Decodes string using MIME base64 algorithm */
void php3_base64_decode(INTERNAL_FUNCTION_PARAMETERS) {
pval *string;
unsigned char *result;
***************
*** 180,186 ****
} else {
RETURN_FALSE;
}
! }
/*
--- 185,191 ----
} else {
RETURN_FALSE;
}
! } /* }}} */
/*
Index: php3/functions/string.c
diff -c php3/functions/string.c:1.145 php3/functions/string.c:1.146
*** php3/functions/string.c:1.145 Sat Oct 10 21:21:39 1998
--- php3/functions/string.c Sat Nov 7 10:56:19 1998
***************
*** 30,36 ****
*/
! /* $Id: string.c,v 1.145 1998/10/11 01:21:39 jim Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 30,36 ----
*/
! /* $Id: string.c,v 1.146 1998/11/07 15:56:19 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 44,49 ****
--- 44,51 ----
#include <locale.h>
#endif
+ /* {{{ proto int strlen(string str)
+ Get string length */
void php3_strlen(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 54,62 ****
}
convert_to_string(str);
RETVAL_LONG(str->value.str.len);
! }
!
void php3_strcmp(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
--- 56,65 ----
}
convert_to_string(str);
RETVAL_LONG(str->value.str.len);
! } /* }}} */
+ /* {{{ proto int strcmp(string str1, string str2)
+ Binary safe string comparison */
void php3_strcmp(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
***************
*** 67,75 ****
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(php3_binary_strcmp(s1,s2));
! }
!
void php3_strcasecmp(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
--- 70,79 ----
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(php3_binary_strcmp(s1,s2));
! } /* }}} */
! /* {{{ proto int strcasecmp(string str1, string str2)
! Binary safe case-insensitive string comparison */
void php3_strcasecmp(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
***************
*** 80,87 ****
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(strcasecmp(s1->value.str.val,s2->value.str.val));
! }
void php3_strspn(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
--- 84,93 ----
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(strcasecmp(s1->value.str.val,s2->value.str.val));
! } /* }}} */
+ /* {{{ proto int strspn(string str, string mask)
+ Find length of initial segment consisting entirely of characters found in mask */
void php3_strspn(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
***************
*** 92,99 ****
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(strspn(s1->value.str.val,s2->value.str.val));
! }
void php3_strcspn(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
--- 98,107 ----
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(strspn(s1->value.str.val,s2->value.str.val));
! } /* }}} */
+ /* {{{ proto int strcspn(string str, string mask)
+ Find length of initial segment consisting entirely of characters not found in mask */
void php3_strcspn(INTERNAL_FUNCTION_PARAMETERS)
{
pval *s1,*s2;
***************
*** 104,112 ****
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(strcspn(s1->value.str.val,s2->value.str.val));
! }
!
void php3_chop(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 112,121 ----
convert_to_string(s1);
convert_to_string(s2);
RETURN_LONG(strcspn(s1->value.str.val,s2->value.str.val));
! } /* }}} */
+ /* {{{ proto string chop(string str)
+ Remove trailing whitespace */
void php3_chop(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 133,140 ****
return;
}
RETURN_FALSE;
! }
void php3_trim(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 142,151 ----
return;
}
RETURN_FALSE;
! } /* }}} */
+ /* {{{ proto string trim(string str)
+ Strip whitespace from the beginning and end of a string */
void php3_trim(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 172,179 ****
return;
}
RETURN_FALSE;
! }
void php3_ltrim(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 183,192 ----
return;
}
RETURN_FALSE;
! } /* }}} */
+ /* {{{ proto string ltrim(string str)
+ Strip whitespace from the beginning of a string */
void php3_ltrim(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 201,208 ****
return;
}
RETURN_FALSE;
! }
void php3_explode(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str, *delim;
--- 214,223 ----
return;
}
RETURN_FALSE;
! } /* }}} */
+ /* {{{ proto array(string separator, string str)
+ Split a string on string separator and return array of components */
void php3_explode(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str, *delim;
***************
*** 236,244 ****
add_index_string(return_value, i++, p1, 1);
}
efree(work_str);
! }
!
void php3_implode(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg1, *arg2, *delim, *tmp, *arr;
--- 251,260 ----
add_index_string(return_value, i++, p1, 1);
}
efree(work_str);
! } /* }}} */
! /* {{{ proto string implode(array src, string glue)
! Join array elements placing glue string between items and return one string */
void php3_implode(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg1, *arg2, *delim, *tmp, *arr;
***************
*** 293,304 ****
}
return_value->type = IS_STRING;
return_value->value.str.len = len;
! }
#ifndef THREAD_SAFE
char *strtok_string;
#endif
void php3_strtok(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str, *tok;
--- 309,322 ----
}
return_value->type = IS_STRING;
return_value->value.str.len = len;
! } /* }}} */
#ifndef THREAD_SAFE
char *strtok_string;
#endif
+ /* {{{ proto string strtok([string str,] string token)
+ Tokenize a string */
void php3_strtok(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str, *tok;
***************
*** 356,362 ****
} else {
RETVAL_FALSE;
}
! }
PHPAPI char *_php3_strtoupper(char *s)
{
--- 374,380 ----
} else {
RETVAL_FALSE;
}
! } /* }}} */
PHPAPI char *_php3_strtoupper(char *s)
{
***************
*** 371,377 ****
return (s);
}
!
void php3_strtoupper(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
--- 389,396 ----
return (s);
}
! /* {{{ proto string strtoupper(string str)
! Make a string uppercase */
void php3_strtoupper(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
***************
*** 385,391 ****
ret = _php3_strtoupper(arg->value.str.val);
RETVAL_STRING(ret,1);
! }
PHPAPI char *_php3_strtolower(char *s)
--- 404,410 ----
ret = _php3_strtoupper(arg->value.str.val);
RETVAL_STRING(ret,1);
! } /* }}} */
PHPAPI char *_php3_strtolower(char *s)
***************
*** 400,407 ****
}
return (s);
}
-
void php3_strtolower(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 419,427 ----
}
return (s);
}
+ /* {{{ proto string strtolower(string str)
+ Make a string lowercase */
void php3_strtolower(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 415,422 ****
ret = _php3_strtolower(str->value.str.val);
RETVAL_STRING(ret,1);
! }
void php3_basename(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 435,444 ----
ret = _php3_strtolower(str->value.str.val);
RETVAL_STRING(ret,1);
! } /* }}} */
+ /* {{{ proto string basename(string path)
+ Return the filename component of the path */
void php3_basename(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 446,452 ****
RETVAL_STRING(str->value.str.val,1);
}
efree(ret);
! }
PHPAPI void _php3_dirname(char *str, int len) {
register char *c;
--- 468,474 ----
RETVAL_STRING(str->value.str.val,1);
}
efree(ret);
! } /* }}} */
PHPAPI void _php3_dirname(char *str, int len) {
register char *c;
***************
*** 467,472 ****
--- 489,496 ----
*c='\0';
}
+ /* {{{ proto string dirname(string path)
+ Return the directory name component of the path */
void php3_dirname(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 481,488 ****
_php3_dirname(ret,str->value.str.len);
RETVAL_STRING(ret,1);
efree(ret);
! }
void php3_strstr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle;
--- 505,514 ----
_php3_dirname(ret,str->value.str.len);
RETVAL_STRING(ret,1);
efree(ret);
! } /* }}} */
+ /* {{{ proto string strstr(string haystack, string needle)
+ Find first occurrence of a string within another */
void php3_strstr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle;
***************
*** 512,519 ****
} else {
RETVAL_FALSE;
}
! }
void php3_strpos(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle, *OFFSET;
--- 538,547 ----
} else {
RETVAL_FALSE;
}
! } /* }}} */
+ /* {{{ proto int strpos(string haystack, string needle)
+ Find position of first occurrence of a string within another */
void php3_strpos(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle, *OFFSET;
***************
*** 559,566 ****
} else {
RETVAL_FALSE;
}
! }
void php3_strrpos(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle;
--- 587,596 ----
} else {
RETVAL_FALSE;
}
! } /* }}} */
+ /* {{{ proto int strrpos(string haystack, string needle)
+ Find the last occurrence of a character in a string within another */
void php3_strrpos(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle;
***************
*** 584,591 ****
} else {
RETVAL_FALSE;
}
! }
void php3_strrchr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle;
--- 614,623 ----
} else {
RETVAL_FALSE;
}
! } /* }}} */
+ /* {{{ proto string strrchr(string haystack, string needle)
+ Find the last occurrence of a character in a string within another */
void php3_strrchr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *haystack, *needle;
***************
*** 612,621 ****
} else {
RETVAL_FALSE;
}
! }
!
! /* args s,m,n */
void php3_substr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *string, *from, *len;
--- 644,653 ----
} else {
RETVAL_FALSE;
}
! } /* }}} */
! /* {{{ proto string substr(string str, int start [, int length])
! Return part of a string */
void php3_substr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *string, *from, *len;
***************
*** 669,677 ****
string->value.str.val[f + l] = '\0';
}
RETVAL_STRING(string->value.str.val + f,1);
! }
!
void php3_quotemeta(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
--- 701,710 ----
string->value.str.val[f + l] = '\0';
}
RETVAL_STRING(string->value.str.val + f,1);
! } /* }}} */
! /* {{{ proto string quotemeta(string str)
! Quote meta characters */
void php3_quotemeta(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
***************
*** 710,718 ****
str[y] = '\0';
RETVAL_STRING(str,1);
efree(str);
! }
!
void php3_ord(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 743,752 ----
str[y] = '\0';
RETVAL_STRING(str,1);
efree(str);
! } /* }}} */
+ /* {{{ proto int ord(string character)
+ Return ASCII value of character */
void php3_ord(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 723,731 ****
}
convert_to_string(str);
RETVAL_LONG((unsigned char)str->value.str.val[0]);
! }
!
void php3_chr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *num;
--- 757,766 ----
}
convert_to_string(str);
RETVAL_LONG((unsigned char)str->value.str.val[0]);
! } /* }}} */
+ /* {{{ proto string chr(int ascii)
+ Convert ASCII code to a character */
void php3_chr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *num;
***************
*** 739,747 ****
temp[0] = (char) num->value.lval;
temp[1] = '\0';
RETVAL_STRINGL(temp, 1,1);
! }
!
void php3_ucfirst(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
--- 774,783 ----
temp[0] = (char) num->value.lval;
temp[1] = '\0';
RETVAL_STRINGL(temp, 1,1);
! } /* }}} */
! /* {{{ proto string(string str)
! Make a string's first character uppercase */
void php3_ucfirst(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
***************
*** 756,763 ****
}
*arg->value.str.val = toupper((unsigned char)*arg->value.str.val);
RETVAL_STRING(arg->value.str.val,1);
! }
void php3_ucwords(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
--- 792,801 ----
}
*arg->value.str.val = toupper((unsigned char)*arg->value.str.val);
RETVAL_STRING(arg->value.str.val,1);
! } /* }}} */
+ /* {{{ proto string ucwords(string str)
+ Uppercase the first character of every word in a string */
void php3_ucwords(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
***************
*** 780,787 ****
}
}
RETVAL_STRING(arg->value.str.val,1);
! }
void php3_strtr(INTERNAL_FUNCTION_PARAMETERS)
{ /* strtr(STRING,FROM,TO) */
pval *str, *from, *to;
--- 818,827 ----
}
}
RETVAL_STRING(arg->value.str.val,1);
! } /* }}} */
+ /* {{{ proto string strtr(string str, string from, string to)
+ Translate characters in str using given translation tables */
void php3_strtr(INTERNAL_FUNCTION_PARAMETERS)
{ /* strtr(STRING,FROM,TO) */
pval *str, *from, *to;
***************
*** 820,829 ****
}
RETVAL_STRING((char *)string,1);
! }
!
void php3_strrev(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 860,870 ----
}
RETVAL_STRING((char *)string,1);
! } /* }}} */
+ /* {{{ proto string strrev(string str)
+ Reverse a string */
void php3_strrev(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 846,852 ****
*return_value = *str;
pval_copy_constructor(return_value);
! }
/* be careful, this edits the string in-place */
--- 887,893 ----
*return_value = *str;
pval_copy_constructor(return_value);
! } /* }}} */
/* be careful, this edits the string in-place */
***************
*** 897,903 ****
}
}
!
void php3_addslashes(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 938,945 ----
}
}
! /* {{{ proto string addslashes(string str)
! Escape single quote, double quotes and backslash characters in a string with backslashes */
void php3_addslashes(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 908,915 ****
convert_to_string(str);
return_value->value.str.val =
_php3_addslashes(str->value.str.val,str->value.str.len,&return_value->value.str.len,0);
return_value->type = IS_STRING;
! }
void php3_stripslashes(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 950,959 ----
convert_to_string(str);
return_value->value.str.val =
_php3_addslashes(str->value.str.val,str->value.str.len,&return_value->value.str.len,0);
return_value->type = IS_STRING;
! } /* }}} */
+ /* {{{ proto string stripslashes(string str)
+ Strip backslashes from a string */
void php3_stripslashes(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 923,929 ****
/* let RETVAL do the estrdup() */
RETVAL_STRING(str->value.str.val,1);
_php3_stripslashes(return_value->value.str.val,&return_value->value.str.len);
! }
#ifndef HAVE_STRERROR
#if !APACHE
--- 967,973 ----
/* let RETVAL do the estrdup() */
RETVAL_STRING(str->value.str.val,1);
_php3_stripslashes(return_value->value.str.val,&return_value->value.str.len);
! } /* }}} */
#ifndef HAVE_STRERROR
#if !APACHE
***************
*** 1207,1223 ****
}
void php3_hebrev(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
! }
void php3_hebrev_with_conversion(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
! }
!
void php3_newline_to_br(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
--- 1251,1272 ----
}
+ /* {{{ proto string hebrev(string str [, int max_chars_per_line])
+ Convert logical Hebrew text to visual text */
void php3_hebrev(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
! } /* }}} */
+ /* {{{ proto string hebrev(string str [, int max_chars_per_line])
+ Convert logical Hebrew text to visual text with newline conversion */
void php3_hebrev_with_conversion(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
! } /* }}} */
+ /* {{{ proto string nl2br(string str)
+ Converts newlines to HTML line breaks */
void php3_newline_to_br(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
***************
*** 1229,1236 ****
convert_to_string(str);
_php3_char_to_str(str->value.str.val,str->value.str.len,'\n',"<br>\n",5,return_value);
! }
void php3_setlocale(INTERNAL_FUNCTION_PARAMETERS)
{
pval *category, *locale;
--- 1278,1287 ----
convert_to_string(str);
_php3_char_to_str(str->value.str.val,str->value.str.len,'\n',"<br>\n",5,return_value);
! } /* }}} */
+ /* {{{ proto string setlocale(string category, string locale)
+ Set locale information */
void php3_setlocale(INTERNAL_FUNCTION_PARAMETERS)
{
pval *category, *locale;
***************
*** 1269,1275 ****
}
#endif
RETURN_FALSE;
! }
/*
* Local variables:
--- 1320,1326 ----
}
#endif
RETURN_FALSE;
! } /* }}} */
/*
* Local variables:
--
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