cvs: /php4/ext/standard formatted_print.c /php4/ext/apache apache.c /php4/ext/aspell aspell.c
| From: | Evan Klinger | Date: | Tue, 23 Nov 1999 06:47:11 +0000 |
| Subject: | cvs: /php4/ext/standard formatted_print.c /php4/ext/apache apache.c /php4/ext/aspell aspell.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6724@lists.php.net to get a copy of this message | ||
evan Tue Nov 23 01:47:11 1999 EDT
Modified files:
/php4/ext/standard formatted_print.c
/php4/ext/apache apache.c
/php4/ext/aspell aspell.c
Log:
Convert to Ex API
# If someone could please check these I'd appreciate it
Index: php4/ext/standard/formatted_print.c
diff -u php4/ext/standard/formatted_print.c:1.9 php4/ext/standard/formatted_print.c:1.10
--- php4/ext/standard/formatted_print.c:1.9 Mon Oct 18 16:00:42 1999
+++ php4/ext/standard/formatted_print.c Tue Nov 23 01:46:39 1999
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: formatted_print.c,v 1.9 1999/10/18 20:00:42 eschmid Exp $ */
+/* $Id: formatted_print.c,v 1.10 1999/11/23 06:46:39 evan Exp $ */
#include <math.h> /* modf() */
#include "php.h"
@@ -367,7 +367,7 @@
static char *
php3_formatted_print(int ht, int *len)
{
- pval **args;
+ pval ***args;
int argc, size = 240, inpos = 0, outpos = 0;
int alignment, width, precision, currarg, adjusting;
char *format, *result, padding;
@@ -377,14 +377,14 @@
if (argc < 1) {
WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
}
- args = emalloc(argc * sizeof(pval *));
+ args = (pval ***)emalloc(argc * sizeof(pval *));
- if (getParametersArray(ht, argc, args) == FAILURE) {
+ if (getParametersArrayEx(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
}
- convert_to_string(args[0]);
- format = args[0]->value.str.val;
+ convert_to_string_ex(args[0]);
+ format = (*args[0])->value.str.val;
result = emalloc(size);
currarg = 1;
@@ -470,66 +470,66 @@
/* now we expect to find a type specifier */
switch (format[inpos]) {
case 's':
- convert_to_string(args[currarg]);
+ convert_to_string_ex(args[currarg]);
php_sprintf_appendstring(&result, &outpos, &size,
- args[currarg]->value.str.val,
+ (*args[currarg])->value.str.val,
width, precision, padding,
alignment,
- args[currarg]->value.str.len,0);
+ (*args[currarg])->value.str.len,0);
break;
case 'd':
- convert_to_long(args[currarg]);
+ convert_to_long_ex(args[currarg]);
php_sprintf_appendint(&result, &outpos, &size,
- args[currarg]->value.lval,
+ (*args[currarg])->value.lval,
width, padding, alignment);
break;
case 'e':
case 'f':
/* XXX not done */
- convert_to_double(args[currarg]);
+ convert_to_double_ex(args[currarg]);
php_sprintf_appenddouble(&result, &outpos, &size,
- args[currarg]->value.dval,
+ (*args[currarg])->value.dval,
width, padding, alignment,
precision, adjusting,
format[inpos]);
break;
case 'c':
- convert_to_long(args[currarg]);
+ convert_to_long_ex(args[currarg]);
php_sprintf_appendchar(&result, &outpos, &size,
- (char) args[currarg]->value.lval);
+ (char) (*args[currarg])->value.lval);
break;
case 'o':
- convert_to_long(args[currarg]);
+ convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
+ (*args[currarg])->value.lval,
width, padding, alignment, 3,
hexchars);
break;
case 'x':
- convert_to_long(args[currarg]);
+ convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
+ (*args[currarg])->value.lval,
width, padding, alignment, 4,
hexchars);
break;
case 'X':
- convert_to_long(args[currarg]);
+ convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
+ (*args[currarg])->value.lval,
width, padding, alignment, 4,
HEXCHARS);
break;
case 'b':
- convert_to_long(args[currarg]);
+ convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
+ (*args[currarg])->value.lval,
width, padding, alignment, 1,
hexchars);
break;
Index: php4/ext/apache/apache.c
diff -u php4/ext/apache/apache.c:1.21 php4/ext/apache/apache.c:1.22
--- php4/ext/apache/apache.c:1.21 Mon Sep 27 12:34:27 1999
+++ php4/ext/apache/apache.c Tue Nov 23 01:46:40 1999
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apache.c,v 1.21 1999/09/27 16:34:27 ssb Exp $ */
+/* $Id: apache.c,v 1.22 1999/11/23 06:46:40 evan Exp $ */
#include "php.h"
#include "ext/standard/head.h"
#include "php_globals.h"
@@ -121,22 +121,22 @@
Get and set Apache request notes */
PHP_FUNCTION(apache_note)
{
- pval *arg_name,*arg_val;
+ pval **arg_name,**arg_val;
char *note_val;
int arg_count = ARG_COUNT(ht);
SLS_FETCH();
if (arg_count<1 || arg_count>2 ||
- getParameters(ht,arg_count,&arg_name,&arg_val) == FAILURE ) {
+ getParametersEx(arg_count,&arg_name,&arg_val) ==FAILURE ) {
WRONG_PARAM_COUNT;
}
- convert_to_string(arg_name);
- note_val = (char *) table_get(((request_rec *)
SG(server_context))->notes,arg_name->value.str.val);
+ convert_to_string_ex(arg_name);
+ note_val = (char *) table_get(((request_rec
*)SG(server_context))->notes,(*arg_name)->value.str.val);
if (arg_count == 2) {
- convert_to_string(arg_val);
- table_set(((request_rec *)
SG(server_context))->notes,arg_name->value.str.val,arg_val->value.str.val);
+ convert_to_string_ex(arg_val);
+ table_set(((request_rec
*)SG(server_context))->notes,(*arg_name)->value.str.val,(*arg_val)->value.str.val);
}
if (note_val) {
@@ -274,23 +274,23 @@
Perform an Apache sub-request */
PHP_FUNCTION(virtual)
{
- pval *filename;
+ pval **filename;
request_rec *rr = NULL;
SLS_FETCH();
- if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1,&filename) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(filename);
+ convert_to_string_ex(filename);
- if (!(rr = sub_req_lookup_uri (filename->value.str.val, ((request_rec *) SG(server_context)))))
{
- php_error(E_WARNING, "Unable to include '%s' - URI lookup failed",
filename->value.str.val);
+ if (!(rr = sub_req_lookup_uri ((*filename)->value.str.val,((request_rec *)
SG(server_context))))) {
+ php_error(E_WARNING, "Unable to include '%s' - URI lookup failed",
(*filename)->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
}
if (rr->status != 200) {
- php_error(E_WARNING, "Unable to include '%s' - error finding URI",
filename->value.str.val);
+ php_error(E_WARNING, "Unable to include '%s' - error finding URI",
(*filename)->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
}
@@ -299,13 +299,13 @@
if (rr->content_type &&
!strcmp(rr->content_type, PHP3_MIME_TYPE)) {
php_error(E_WARNING, "Cannot include a PHP file "
- "(use <code><?include \"%s\"></code> instead)",
filename->value.str.val);
+ "(use <code><?include \"%s\"></code> instead)",
(*filename)->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
}
if (run_sub_req(rr)) {
- php_error(E_WARNING, "Unable to include '%s' - request execution failed",
filename->value.str.val);
+ php_error(E_WARNING, "Unable to include '%s' - request execution failed",
(*filename)->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
} else {
@@ -347,17 +347,17 @@
Perform a partial request of the given URI to obtain information about it */
PHP_FUNCTION(apache_lookup_uri)
{
- pval *filename;
+ pval **filename;
request_rec *rr=NULL;
SLS_FETCH();
- if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1,&filename) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(filename);
+ convert_to_string_ex(filename);
- if(!(rr = sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) {
- php_error(E_WARNING, "URI lookup failed", filename->value.str.val);
+ if(!(rr = sub_req_lookup_uri((*filename)->value.str.val,((request_rec *) SG(server_context)))))
{
+ php_error(E_WARNING, "URI lookup failed",(*filename)->value.str.val);
RETURN_FALSE;
}
object_init(return_value);
@@ -421,17 +421,17 @@
PHP_FUNCTION(apache_exec_uri)
{
- pval *filename;
+ pval **filename;
request_rec *rr=NULL;
SLS_FETCH();
- if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1,&filename) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(filename);
+ convert_to_string_ex(filename);
- if(!(rr = ap_sub_req_lookup_uri(filename->value.str.val, ((request_rec *)
SG(server_context))))) {
- php_error(E_WARNING, "URI lookup failed", filename->value.str.val);
+ if(!(rr = ap_sub_req_lookup_uri((*filename)->value.str.val,((request_rec *)
SG(server_context))))) {
+ php_error(E_WARNING, "URI lookup failed",(*filename)->value.str.val);
RETURN_FALSE;
}
RETVAL_LONG(ap_run_sub_req(rr));
Index: php4/ext/aspell/aspell.c
diff -u php4/ext/aspell/aspell.c:1.5 php4/ext/aspell/aspell.c:1.6
--- php4/ext/aspell/aspell.c:1.5 Mon Aug 2 15:16:39 1999
+++ php4/ext/aspell/aspell.c Tue Nov 23 01:46:40 1999
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: aspell.c,v 1.5 1999/08/02 19:16:39 zeev Exp $ */
+/* $Id: aspell.c,v 1.6 1999/11/23 06:46:40 evan Exp $ */
#include "php.h"
#if defined(COMPILE_DL)
@@ -70,23 +70,23 @@
Load a dictionary */
PHP_FUNCTION(aspell_new)
{
- pval *master, *personal;
+ pval **master,**personal;
int argc;
aspell *sc;
int ind;
argc = ARG_COUNT(ht);
- if (argc < 1 || argc > 2 || getParameters(ht, argc, &master,&personal) == FAILURE) {
+ if (argc < 1 || argc > 2 || getParametersEx(argc,&master,&personal) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(master);
+ convert_to_string_ex(master);
if(argc==2)
{
- convert_to_string(personal) ;
- sc=aspell_new(master->value.str.val,personal->value.str.val);
+ convert_to_string_ex(personal) ;
+ sc=aspell_new((*master)->value.str.val,(*personal)->value.str.val);
}
else
- sc=aspell_new(master->value.str.val,"");
+ sc=aspell_new((*master)->value.str.val,"");
ind = php3_list_insert(sc, le_aspell);
RETURN_LONG(ind);
@@ -98,7 +98,7 @@
Return array of Suggestions */
PHP_FUNCTION(aspell_suggest)
{
- pval *scin, *word;
+ pval **scin, **word;
int argc;
aspell *sc;
int ind,type;
@@ -107,15 +107,15 @@
argc = ARG_COUNT(ht);
- if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
+ if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(scin);
- convert_to_string(word);
- sc= (aspell *) php3_list_find(scin->value.lval, &type);
+ convert_to_long_ex(scin);
+ convert_to_string_ex(word);
+ sc = (aspell *)php3_list_find((*scin)->value.lval, &type);
if(!sc)
{
- php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
+ php_error(E_WARNING, "%d is not an ASPELL result index",(*scin)->value.lval);
RETURN_FALSE;
}
@@ -123,7 +123,7 @@
RETURN_FALSE;
}
- sug = aspell_suggest(sc, word->value.str.val);
+ sug = aspell_suggest(sc, (*word)->value.str.val);
for (i = 0; i != sug->size; ++i) {
add_next_index_string(return_value,(char *)sug->data[i],1);
}
@@ -136,23 +136,23 @@
PHP_FUNCTION(aspell_check)
{
int type;
- pval *scin,*word;
+ pval **scin,**word;
aspell *sc;
int argc;
argc = ARG_COUNT(ht);
- if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
+ if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(scin);
- convert_to_string(word);
- sc= (aspell *) php3_list_find(scin->value.lval, &type);
+ convert_to_long_ex(scin);
+ convert_to_string_ex(word);
+ sc= (aspell *) php3_list_find((*scin)->value.lval, &type);
if(!sc)
{
- php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
+ php_error(E_WARNING, "%d is not an ASPELL result index",(*scin)->value.lval);
RETURN_FALSE;
}
- if (aspell_check(sc, word->value.str.val))
+ if (aspell_check(sc, (*word)->value.str.val))
{
RETURN_TRUE;
}
@@ -167,24 +167,24 @@
Return if word is valid, ignoring case or trying to trim it in any way*/
PHP_FUNCTION(aspell_check_raw)
{
- pval *scin,*word;
+ pval **scin,**word;
int type;
int argc;
aspell *sc;
argc = ARG_COUNT(ht);
- if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
+ if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(scin);
- convert_to_string(word);
- sc= (aspell *) php3_list_find(scin->value.lval, &type);
+ convert_to_long_ex(scin);
+ convert_to_string_ex(word);
+ sc = (aspell *)php3_list_find((*scin)->value.lval, &type);
if(!sc)
{
- php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
+ php_error(E_WARNING, "%d is not an ASPELL result index",(*scin)->value.lval);
RETURN_FALSE;
}
- if (aspell_check_raw(sc, word->value.str.val))
+ if (aspell_check_raw(sc, (*word)->value.str.val))
{
RETURN_TRUE;
}