]> granicus.if.org Git - php/commitdiff
Convert to Ex API
authorEvan Klinger <evan@php.net>
Tue, 23 Nov 1999 06:46:40 +0000 (06:46 +0000)
committerEvan Klinger <evan@php.net>
Tue, 23 Nov 1999 06:46:40 +0000 (06:46 +0000)
# If someone could please check these I'd appreciate it

ext/apache/apache.c
ext/aspell/aspell.c
ext/standard/formatted_print.c

index 8c8d50a82c765e4bd3836f5bf53da14ee93ac7fb..cda5fab222f86b0aff8a8ed3447c4c0fe8b29cbc 100644 (file)
@@ -121,22 +121,22 @@ php3_module_entry apache_module_entry = {
    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 @@ PHP_MINFO_FUNCTION(apache)
    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 @@ PHP_FUNCTION(virtual)
        if (rr->content_type &&
                !strcmp(rr->content_type, PHP3_MIME_TYPE)) {
                php_error(E_WARNING, "Cannot include a PHP file "
-                         "(use <code>&lt;?include \"%s\"&gt;</code> instead)", filename->value.str.val);
+                         "(use <code>&lt;?include \"%s\"&gt;</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 @@ PHP_FUNCTION(getallheaders)
    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 @@ This function is most likely a bad idea.  Just playing with it for now.
 
 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 fcfb33cbceaf4a007588889c35185da60435e4c3..2b19d533d4ca59494225ef6a02a2cc3fc2259a56 100644 (file)
@@ -70,23 +70,23 @@ void php3_aspell_close(aspell *sc)
    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 @@ PHP_FUNCTION(aspell_new)
    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 @@ PHP_FUNCTION(aspell_suggest)
 
        
        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 @@ PHP_FUNCTION(aspell_suggest)
                 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_suggest)
 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 @@ PHP_FUNCTION(aspell_check)
    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;
          }
index 4dc7b0417b9ecd19097ee800925ba6d8d028fb0c..a3b6b71ba3f35a2b7bc4d13771c97ccb5344f5ba 100644 (file)
@@ -367,7 +367,7 @@ php_sprintf_getnumber(char *buffer, int *pos)
 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 @@ php3_formatted_print(int ht, int *len)
        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 @@ php3_formatted_print(int ht, int *len)
                        /* 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;