cvs: php4 /ext/skeleton create_stubs
| From: | Rasmus Lerdorf | Date: | Wed, 08 Aug 2001 00:20:19 +0000 |
| Subject: | cvs: php4 /ext/skeleton create_stubs | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6643@lists.php.net to get a copy of this message | ||
rasmus Tue Aug 7 20:20:19 2001 EDT
Modified files:
/php4/ext/skeleton create_stubs
Log:
Fixed a bunch of problems here
Index: php4/ext/skeleton/create_stubs
diff -u php4/ext/skeleton/create_stubs:1.13 php4/ext/skeleton/create_stubs:1.14
--- php4/ext/skeleton/create_stubs:1.13 Thu Aug 2 01:49:24 2001
+++ php4/ext/skeleton/create_stubs Tue Aug 7 20:20:19 2001
@@ -52,7 +52,7 @@
} else {
resources = resources "\tZEND_FETCH_RESOURCE(???, ???, " name ext ", " name
"_id, \"???\", ???_rsrc_id);\n"
}
- funcvals = funcvals "\tint " name "_id = -1;\n"
+ ints = ints "\tint " name "_id = -1;\n"
} else {
x = comment(tabs "/* Write your own code here to handle argument " name ".
*/\n")
}
@@ -121,36 +121,43 @@
if (gobble("\\[")) optional = 1
while (arg_type = gobble(type)) {
arg_name = gobble(name)
- argtypes[num_funcs,args_max] = arg_type
- argnames[num_funcs,args_max] = arg_name
+ if(arg_type == "void") {
+ args_max = 0;
+ args_min = 0;
+ break;
+ } else {
+ argtypes[num_funcs,args_max] = arg_type
+ argnames[num_funcs,args_max] = arg_name
- args_max++
- if (optional) {
- optionals[num_funcs,i] = optional
- if (arg_type != "resource") {
- useswitch[num_funcs] = 1
+ args_max++
+ if (optional) {
+ optionals[num_funcs,i] = optional
+ if (arg_type != "resource") {
+ useswitch[num_funcs] = 1
+ }
+ } else {
+ args_min++
}
- } else {
- args_min++
- }
- if (x = gobble("\\[")) {
- optional++
- }
+ if (x = gobble("\\[")) {
+ optional++
+ }
- y = gobble(",")
- if (!x && y && optional) {
- check_argc_in_switch[num_funcs] = 1
- grouped_optional_param[num_funcs,i] = 1
+ y = gobble(",")
+ if (!x && y && optional) {
+ check_argc_in_switch[num_funcs] = 1
+ grouped_optional_param[num_funcs,i] = 1
+ }
+ i++
}
- i++
}
}
- if (x = gobble("\\)")) {
+# if (x = gobble("\\)")) {
+ gobble("\\]* *)")
sub(/^[ \t]+/, "", line)
fcomments[num_funcs] = line
- }
+# }
funcs[num_funcs] = func_name
types[num_funcs] = func_type
@@ -163,37 +170,34 @@
END {
if (xml) print xmlhead > xmldoc
for (i = 0; i < num_funcs; i++) {
-
compareargc = maxargs[i] - minargs[i]
- closefetch = xmlparams = funcvals = resources = handleargs = closeopts = ""
+ closefetch = fetchargs = zvals = xmlparams = funcvals = resources = handleargs = closeopts =
""
ints = doubles = floats = strings = arrays = ""
proto = "/* {{{ proto " types[i] " " funcs[i] "("
+ refid = funcs[i]
+ gsub(/_/, "-", refid)
+ xmlstr = " <refentry id=\"function." refid "\">\n" \
+ " <refnamediv>\n" \
+ " <refname>" funcs[i] "</refname>\n" \
+ " <refpurpose>" fcomments[i] "</refpurpose>\n" \
+ " </refnamediv>\n" \
+ " <refsect1>\n" \
+ " <title>Description</title>\n" \
+ " <funcsynopsis>\n" \
+ " <funcprototype>\n" \
+ " <funcdef>" types[i] " <function>" funcs[i]
"</function></funcdef>\n"
- refid = funcs[i]
- gsub(/_/, "-", refid)
- xmlstr = " <refentry id=\"function." refid "\">\n" \
- " <refnamediv>\n" \
- " <refname>" funcs[i] "</refname>\n" \
- " <refpurpose>" fcomments[i] "</refpurpose>\n" \
- " </refnamediv>\n" \
- " <refsect1>\n" \
- " <title>Description</title>\n" \
- " <funcsynopsis>\n" \
- " <funcprototype>\n" \
- " <funcdef>" types[i] " <function>" funcs[i]
"</function></funcdef>\n"
-
- if (maxargs[i]) {
+ if (maxargs[i]>0) {
zvals = "\tzval "
if (compareargc) {
- funcvals = "\tint argc;\n"
if (minargs[i]) {
- fetchargs = "\targc = ZEND_NUM_ARGS();\n\tif (argc < " \
+ fetchargs = "\tint argc = ZEND_NUM_ARGS();\n\tif (argc < " \
minargs[i] " || argc > " maxargs[i] \
" || zend_get_parameters_ex(argc, "
} else {
- fetchargs = "\targc = ZEND_NUM_ARGS();\n\tif (argc > " \
+ fetchargs = "\tint argc = ZEND_NUM_ARGS();\n\tif (argc > " \
maxargs[i] " || (argc && zend_get_parameters_ex(argc, "
closefetch = ")"
}
@@ -269,7 +273,7 @@
proto = proto closeopts ")\n " fcomments[i] " */\nPHP_FUNCTION(" funcs[i]
")\n{"
if (maxargs[i]) {
zvals = zvals ";"
- fetchargs = fetchargs ") == FAILURE)" closefetch
"{\n\t\tZEND_WRONG_PARAM_COUNT();\n\t}\n"
+ fetchargs = fetchargs ") == FAILURE)" closefetch "
{\n\t\tZEND_WRONG_PARAM_COUNT();\n\t}\n"
}
if (assign_params) funcvals = ints doubles floats strings
if (useswitch[i]) {