(gen_wrapper): use the generated version of name for function, if no
function is is used, also use the generated name for the structure name. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15774 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -408,33 +408,34 @@ gen_wrapper(struct assignment *as) | |||||||
|     struct assignment *opt1; |     struct assignment *opt1; | ||||||
|     struct assignment *function; |     struct assignment *function; | ||||||
|     struct assignment *tmp; |     struct assignment *tmp; | ||||||
|     char *f; |     char *n, *f; | ||||||
|     int nargs = 0; |     int nargs = 0; | ||||||
|     int seen_strings = 0; |     int seen_strings = 0; | ||||||
|  |  | ||||||
|     name = find(as, "name"); |     name = find(as, "name"); | ||||||
|  |     n = strdup(name->u.value); | ||||||
|  |     gen_name(n); | ||||||
|     arg = find(as, "argument"); |     arg = find(as, "argument"); | ||||||
|     opt1 = find(as, "option"); |     opt1 = find(as, "option"); | ||||||
|     function = find(as, "function"); |     function = find(as, "function"); | ||||||
|     if(function == NULL) |     if(function) | ||||||
| 	function = name; | 	f = function->u.value; | ||||||
|     f = strdup(name->u.value); |     else | ||||||
|     gen_name(f); | 	f = n; | ||||||
|  |      | ||||||
|         |         | ||||||
|     if(opt1 != NULL) { |     if(opt1 != NULL) { | ||||||
| 	gen_options(opt1, name->u.value); | 	gen_options(opt1, n); | ||||||
| 	hprint(0, "int %s(struct %s_options*, int, char **);\n",  | 	hprint(0, "int %s(struct %s_options*, int, char **);\n", f, n); | ||||||
| 	       function->u.value, name->u.value); |  | ||||||
|     } else { |     } else { | ||||||
| 	hprint(0, "int %s(void*, int, char **);\n",  | 	hprint(0, "int %s(void*, int, char **);\n", f); | ||||||
| 	       function->u.value); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fprintf(cfile, "static int\n"); |     fprintf(cfile, "static int\n"); | ||||||
|     fprintf(cfile, "%s_wrap(int argc, char **argv)\n", f); |     fprintf(cfile, "%s_wrap(int argc, char **argv)\n", n); | ||||||
|     fprintf(cfile, "{\n"); |     fprintf(cfile, "{\n"); | ||||||
|     if(opt1 != NULL) |     if(opt1 != NULL) | ||||||
| 	cprint(1, "struct %s_options opt;\n", name->u.value); | 	cprint(1, "struct %s_options opt;\n", n); | ||||||
|     cprint(1, "int ret;\n"); |     cprint(1, "int ret;\n"); | ||||||
|     cprint(1, "int optidx = 0;\n"); |     cprint(1, "int optidx = 0;\n"); | ||||||
|     cprint(1, "struct getargs args[] = {\n"); |     cprint(1, "struct getargs args[] = {\n"); | ||||||
| @@ -590,8 +591,7 @@ gen_wrapper(struct assignment *as) | |||||||
|     cprint(2, "goto usage;\n"); |     cprint(2, "goto usage;\n"); | ||||||
|  |  | ||||||
|     cprint(1, "ret = %s(%s, argc - optidx, argv + optidx);\n",  |     cprint(1, "ret = %s(%s, argc - optidx, argv + optidx);\n",  | ||||||
| 	   function->u.value,  | 	   f, opt1 ? "&opt": "NULL"); | ||||||
| 	   opt1 ? "&opt": "NULL"); |  | ||||||
|     if(seen_strings) { |     if(seen_strings) { | ||||||
| 	if(seen_strings) { | 	if(seen_strings) { | ||||||
| 	    for(tmp = find(as, "option");  | 	    for(tmp = find(as, "option");  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand