Convert to Ex API

# If someone could please check these I'd appreciate it
This commit is contained in:
Evan Klinger 1999-11-23 06:46:40 +00:00
parent 5385610450
commit 42f8f2516d
3 changed files with 73 additions and 73 deletions

View file

@ -121,22 +121,22 @@ php3_module_entry apache_module_entry = {
Get and set Apache request notes */ Get and set Apache request notes */
PHP_FUNCTION(apache_note) PHP_FUNCTION(apache_note)
{ {
pval *arg_name,*arg_val; pval **arg_name,**arg_val;
char *note_val; char *note_val;
int arg_count = ARG_COUNT(ht); int arg_count = ARG_COUNT(ht);
SLS_FETCH(); SLS_FETCH();
if (arg_count<1 || arg_count>2 || 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; WRONG_PARAM_COUNT;
} }
convert_to_string(arg_name); convert_to_string_ex(arg_name);
note_val = (char *) table_get(((request_rec *) SG(server_context))->notes,arg_name->value.str.val); note_val = (char *) table_get(((request_rec *)SG(server_context))->notes,(*arg_name)->value.str.val);
if (arg_count == 2) { if (arg_count == 2) {
convert_to_string(arg_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); table_set(((request_rec *)SG(server_context))->notes,(*arg_name)->value.str.val,(*arg_val)->value.str.val);
} }
if (note_val) { if (note_val) {
@ -274,23 +274,23 @@ PHP_MINFO_FUNCTION(apache)
Perform an Apache sub-request */ Perform an Apache sub-request */
PHP_FUNCTION(virtual) PHP_FUNCTION(virtual)
{ {
pval *filename; pval **filename;
request_rec *rr = NULL; request_rec *rr = NULL;
SLS_FETCH(); SLS_FETCH();
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) { if (ARG_COUNT(ht) != 1 || getParametersEx(1,&filename) == FAILURE) {
WRONG_PARAM_COUNT; 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))))) { 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); php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", (*filename)->value.str.val);
if (rr) destroy_sub_req (rr); if (rr) destroy_sub_req (rr);
RETURN_FALSE; RETURN_FALSE;
} }
if (rr->status != 200) { 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); if (rr) destroy_sub_req (rr);
RETURN_FALSE; RETURN_FALSE;
} }
@ -299,13 +299,13 @@ PHP_FUNCTION(virtual)
if (rr->content_type && if (rr->content_type &&
!strcmp(rr->content_type, PHP3_MIME_TYPE)) { !strcmp(rr->content_type, PHP3_MIME_TYPE)) {
php_error(E_WARNING, "Cannot include a PHP file " 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); if (rr) destroy_sub_req (rr);
RETURN_FALSE; RETURN_FALSE;
} }
if (run_sub_req(rr)) { 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); if (rr) destroy_sub_req (rr);
RETURN_FALSE; RETURN_FALSE;
} else { } else {
@ -347,17 +347,17 @@ PHP_FUNCTION(getallheaders)
Perform a partial request of the given URI to obtain information about it */ Perform a partial request of the given URI to obtain information about it */
PHP_FUNCTION(apache_lookup_uri) PHP_FUNCTION(apache_lookup_uri)
{ {
pval *filename; pval **filename;
request_rec *rr=NULL; request_rec *rr=NULL;
SLS_FETCH(); SLS_FETCH();
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) { if (ARG_COUNT(ht) != 1 || getParametersEx(1,&filename) == FAILURE) {
WRONG_PARAM_COUNT; 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))))) { 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); php_error(E_WARNING, "URI lookup failed",(*filename)->value.str.val);
RETURN_FALSE; RETURN_FALSE;
} }
object_init(return_value); 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) PHP_FUNCTION(apache_exec_uri)
{ {
pval *filename; pval **filename;
request_rec *rr=NULL; request_rec *rr=NULL;
SLS_FETCH(); SLS_FETCH();
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) { if (ARG_COUNT(ht) != 1 || getParametersEx(1,&filename) == FAILURE) {
WRONG_PARAM_COUNT; 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))))) { 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); php_error(E_WARNING, "URI lookup failed",(*filename)->value.str.val);
RETURN_FALSE; RETURN_FALSE;
} }
RETVAL_LONG(ap_run_sub_req(rr)); RETVAL_LONG(ap_run_sub_req(rr));

View file

@ -70,23 +70,23 @@ void php3_aspell_close(aspell *sc)
Load a dictionary */ Load a dictionary */
PHP_FUNCTION(aspell_new) PHP_FUNCTION(aspell_new)
{ {
pval *master, *personal; pval **master,**personal;
int argc; int argc;
aspell *sc; aspell *sc;
int ind; int ind;
argc = ARG_COUNT(ht); 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; WRONG_PARAM_COUNT;
} }
convert_to_string(master); convert_to_string_ex(master);
if(argc==2) if(argc==2)
{ {
convert_to_string(personal) ; convert_to_string_ex(personal) ;
sc=aspell_new(master->value.str.val,personal->value.str.val); sc=aspell_new((*master)->value.str.val,(*personal)->value.str.val);
} }
else else
sc=aspell_new(master->value.str.val,""); sc=aspell_new((*master)->value.str.val,"");
ind = php3_list_insert(sc, le_aspell); ind = php3_list_insert(sc, le_aspell);
RETURN_LONG(ind); RETURN_LONG(ind);
@ -98,7 +98,7 @@ PHP_FUNCTION(aspell_new)
Return array of Suggestions */ Return array of Suggestions */
PHP_FUNCTION(aspell_suggest) PHP_FUNCTION(aspell_suggest)
{ {
pval *scin, *word; pval **scin, **word;
int argc; int argc;
aspell *sc; aspell *sc;
int ind,type; int ind,type;
@ -107,15 +107,15 @@ PHP_FUNCTION(aspell_suggest)
argc = ARG_COUNT(ht); argc = ARG_COUNT(ht);
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) { if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
} }
convert_to_long(scin); convert_to_long_ex(scin);
convert_to_string(word); convert_to_string_ex(word);
sc= (aspell *) php3_list_find(scin->value.lval, &type); sc = (aspell *)php3_list_find((*scin)->value.lval, &type);
if(!sc) 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; RETURN_FALSE;
} }
@ -123,7 +123,7 @@ PHP_FUNCTION(aspell_suggest)
RETURN_FALSE; 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) { for (i = 0; i != sug->size; ++i) {
add_next_index_string(return_value,(char *)sug->data[i],1); add_next_index_string(return_value,(char *)sug->data[i],1);
} }
@ -136,23 +136,23 @@ PHP_FUNCTION(aspell_suggest)
PHP_FUNCTION(aspell_check) PHP_FUNCTION(aspell_check)
{ {
int type; int type;
pval *scin,*word; pval **scin,**word;
aspell *sc; aspell *sc;
int argc; int argc;
argc = ARG_COUNT(ht); argc = ARG_COUNT(ht);
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) { if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
} }
convert_to_long(scin); convert_to_long_ex(scin);
convert_to_string(word); convert_to_string_ex(word);
sc= (aspell *) php3_list_find(scin->value.lval, &type); sc= (aspell *) php3_list_find((*scin)->value.lval, &type);
if(!sc) 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; RETURN_FALSE;
} }
if (aspell_check(sc, word->value.str.val)) if (aspell_check(sc, (*word)->value.str.val))
{ {
RETURN_TRUE; 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*/ Return if word is valid, ignoring case or trying to trim it in any way*/
PHP_FUNCTION(aspell_check_raw) PHP_FUNCTION(aspell_check_raw)
{ {
pval *scin,*word; pval **scin,**word;
int type; int type;
int argc; int argc;
aspell *sc; aspell *sc;
argc = ARG_COUNT(ht); argc = ARG_COUNT(ht);
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) { if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT; WRONG_PARAM_COUNT;
} }
convert_to_long(scin); convert_to_long_ex(scin);
convert_to_string(word); convert_to_string_ex(word);
sc= (aspell *) php3_list_find(scin->value.lval, &type); sc = (aspell *)php3_list_find((*scin)->value.lval, &type);
if(!sc) 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; RETURN_FALSE;
} }
if (aspell_check_raw(sc, word->value.str.val)) if (aspell_check_raw(sc, (*word)->value.str.val))
{ {
RETURN_TRUE; RETURN_TRUE;
} }

View file

@ -367,7 +367,7 @@ php_sprintf_getnumber(char *buffer, int *pos)
static char * static char *
php3_formatted_print(int ht, int *len) php3_formatted_print(int ht, int *len)
{ {
pval **args; pval ***args;
int argc, size = 240, inpos = 0, outpos = 0; int argc, size = 240, inpos = 0, outpos = 0;
int alignment, width, precision, currarg, adjusting; int alignment, width, precision, currarg, adjusting;
char *format, *result, padding; char *format, *result, padding;
@ -377,14 +377,14 @@ php3_formatted_print(int ht, int *len)
if (argc < 1) { if (argc < 1) {
WRONG_PARAM_COUNT_WITH_RETVAL(NULL); 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); efree(args);
WRONG_PARAM_COUNT_WITH_RETVAL(NULL); WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
} }
convert_to_string(args[0]); convert_to_string_ex(args[0]);
format = args[0]->value.str.val; format = (*args[0])->value.str.val;
result = emalloc(size); result = emalloc(size);
currarg = 1; currarg = 1;
@ -470,66 +470,66 @@ php3_formatted_print(int ht, int *len)
/* now we expect to find a type specifier */ /* now we expect to find a type specifier */
switch (format[inpos]) { switch (format[inpos]) {
case 's': case 's':
convert_to_string(args[currarg]); convert_to_string_ex(args[currarg]);
php_sprintf_appendstring(&result, &outpos, &size, php_sprintf_appendstring(&result, &outpos, &size,
args[currarg]->value.str.val, (*args[currarg])->value.str.val,
width, precision, padding, width, precision, padding,
alignment, alignment,
args[currarg]->value.str.len,0); (*args[currarg])->value.str.len,0);
break; break;
case 'd': case 'd':
convert_to_long(args[currarg]); convert_to_long_ex(args[currarg]);
php_sprintf_appendint(&result, &outpos, &size, php_sprintf_appendint(&result, &outpos, &size,
args[currarg]->value.lval, (*args[currarg])->value.lval,
width, padding, alignment); width, padding, alignment);
break; break;
case 'e': case 'e':
case 'f': case 'f':
/* XXX not done */ /* XXX not done */
convert_to_double(args[currarg]); convert_to_double_ex(args[currarg]);
php_sprintf_appenddouble(&result, &outpos, &size, php_sprintf_appenddouble(&result, &outpos, &size,
args[currarg]->value.dval, (*args[currarg])->value.dval,
width, padding, alignment, width, padding, alignment,
precision, adjusting, precision, adjusting,
format[inpos]); format[inpos]);
break; break;
case 'c': case 'c':
convert_to_long(args[currarg]); convert_to_long_ex(args[currarg]);
php_sprintf_appendchar(&result, &outpos, &size, php_sprintf_appendchar(&result, &outpos, &size,
(char) args[currarg]->value.lval); (char) (*args[currarg])->value.lval);
break; break;
case 'o': case 'o':
convert_to_long(args[currarg]); convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size, php_sprintf_append2n(&result, &outpos, &size,
args[currarg]->value.lval, (*args[currarg])->value.lval,
width, padding, alignment, 3, width, padding, alignment, 3,
hexchars); hexchars);
break; break;
case 'x': case 'x':
convert_to_long(args[currarg]); convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size, php_sprintf_append2n(&result, &outpos, &size,
args[currarg]->value.lval, (*args[currarg])->value.lval,
width, padding, alignment, 4, width, padding, alignment, 4,
hexchars); hexchars);
break; break;
case 'X': case 'X':
convert_to_long(args[currarg]); convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size, php_sprintf_append2n(&result, &outpos, &size,
args[currarg]->value.lval, (*args[currarg])->value.lval,
width, padding, alignment, 4, width, padding, alignment, 4,
HEXCHARS); HEXCHARS);
break; break;
case 'b': case 'b':
convert_to_long(args[currarg]); convert_to_long_ex(args[currarg]);
php_sprintf_append2n(&result, &outpos, &size, php_sprintf_append2n(&result, &outpos, &size,
args[currarg]->value.lval, (*args[currarg])->value.lval,
width, padding, alignment, 1, width, padding, alignment, 1,
hexchars); hexchars);
break; break;