Commit a6dfed4a authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

rewrite function_def_get_arg_name

2009-08-14 Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* src/func.c (function_def_get_arg_name): rewrite without using
	  fn_def->arg_names
parent 3ef34ab7
2009-08-14 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/func.c (function_def_get_arg_name): rewrite without using
fn_def->arg_names
2009-08-14 Morten Welinder <terra@gnome.org> 2009-08-14 Morten Welinder <terra@gnome.org>
* src/func.c (gnm_func_sanity_check1): Check argument count too. * src/func.c (gnm_func_sanity_check1): Check argument count too.
......
...@@ -1109,39 +1109,24 @@ function_def_get_arg_type_string (GnmFunc const *fn_def, ...@@ -1109,39 +1109,24 @@ function_def_get_arg_type_string (GnmFunc const *fn_def,
char * char *
function_def_get_arg_name (GnmFunc const *fn_def, int arg_idx) function_def_get_arg_name (GnmFunc const *fn_def, int arg_idx)
{ {
const char *start, *end; int i;
const char *translated_arguments;
gunichar uc;
char delimiter[7];
g_return_val_if_fail (arg_idx >= 0, NULL); g_return_val_if_fail (arg_idx >= 0, NULL);
g_return_val_if_fail (fn_def != NULL, NULL); g_return_val_if_fail (fn_def != NULL, NULL);
gnm_func_load_if_stub ((GnmFunc *)fn_def); gnm_func_load_if_stub ((GnmFunc *)fn_def);
if (!fn_def->arg_names) for (i = 0;
return NULL; fn_def->help[i].type != GNM_FUNC_HELP_END;
i++) {
translated_arguments = (strlen (fn_def->arg_names)>0 if (fn_def->help[i].type == GNM_FUNC_HELP_ARG) {
? _(fn_def->arg_names) if (arg_idx == 0)
: fn_def->arg_names); return split_at_colon (_(fn_def->help[i].text), NULL);
uc = (strcmp (translated_arguments, fn_def->arg_names) == 0) else
? ',' arg_idx--;
: go_locale_get_arg_sep (); }
delimiter[g_unichar_to_utf8 (uc, delimiter)] = 0;
start = translated_arguments;
while (arg_idx > 0) {
const char *del = strstr (start, delimiter);
if (!del)
return NULL;
arg_idx--;
start = del + strlen (delimiter);
} }
end = strstr (start, delimiter); return NULL;
if (!end) end = start + strlen (start);
return g_strndup (start, end - start);
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment