[gnumeric] Introspection fixes



commit b842e450ed111db9ba6b73a47dc78e3d8725e370
Author: Morten Welinder <terra gnome org>
Date:   Sat Apr 14 22:12:58 2018 -0400

    Introspection fixes

 ChangeLog                             |    7 ++++
 plugins/guile/plugin.c                |    2 +-
 plugins/perl-loader/perl-gnumeric.c   |    2 +-
 plugins/perl-loader/perl-loader.c     |    2 +-
 plugins/python-loader/python-loader.c |    2 +-
 plugins/qpro/qpro-read.c              |    2 +-
 src/dialogs/dialog-formula-guru.c     |    6 ++--
 src/dialogs/dialog-function-select.c  |    2 +-
 src/func.c                            |   50 ++++++++++++++------------------
 src/func.h                            |    8 ++--
 src/sstest.c                          |    4 +-
 src/widgets/gnumeric-expr-entry.c     |    4 +-
 12 files changed, 46 insertions(+), 45 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0db1341..cb54e2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2018-04-14  Morten Welinder  <terra gnome org>
 
+       * src/func.c (gnm_func_count_args): Rename from
+       function_def_count_args for introspection.
+       (gnm_func_get_arg_type): Rename from function_def_get_arg_type
+       for introspection.
+       (gnm_func_get_arg_type_sring): Rename from
+       function_def_get_arg_type_string for introspection.
+
        * src/workbook-view.c (workbook_view_save_as): Rename from
        wb_view_save_as for introspection.
        (workbook_view_save): Rename from wb_view_save for introspection.
diff --git a/plugins/guile/plugin.c b/plugins/guile/plugin.c
index 20788ff..bd38af2 100644
--- a/plugins/guile/plugin.c
+++ b/plugins/guile/plugin.c
@@ -145,7 +145,7 @@ func_marshal_func (GnmFuncEvalInfo *ei, GnmValue *argv[])
        g_return_val_if_fail (ei != NULL, NULL);
 
        fndef = gnm_eval_info_get_func (ei);
-       function_def_count_args (fndef, &min, &max);
+       gnm_func_count_args (fndef, &min, &max);
 
        function = (SCM) gnm_func_get_user_data (fndef);
 
diff --git a/plugins/perl-loader/perl-gnumeric.c b/plugins/perl-loader/perl-gnumeric.c
index e14968b..b23ddfa 100644
--- a/plugins/perl-loader/perl-gnumeric.c
+++ b/plugins/perl-loader/perl-gnumeric.c
@@ -64,7 +64,7 @@ marshal_func (GnmFuncEvalInfo *ei, GnmValue *argv[])
     SAVETMPS;
 
     PUSHMARK(sp);
-    function_def_count_args (func, &min, &max);
+    gnm_func_count_args (func, &min, &max);
 
     for (i = 0; i < max && argv[i] != NULL; i++) {
        XPUSHs(sv_2mortal(value2perl(argv[i])));
diff --git a/plugins/perl-loader/perl-loader.c b/plugins/perl-loader/perl-loader.c
index f3606f0..81c0acc 100644
--- a/plugins/perl-loader/perl-loader.c
+++ b/plugins/perl-loader/perl-loader.c
@@ -55,7 +55,7 @@ call_perl_function_args (GnmFuncEvalInfo *ei, GnmValue const * const *args)
        fndef = gnm_expr_get_func_def ((GnmExpr *)(ei->func_call));
        perl_func = g_strconcat ("func_", fndef->name, NULL);
 
-       function_def_count_args (fndef, &min_n_args, &max_n_args);
+       gnm_func_count_args (fndef, &min_n_args, &max_n_args);
        for (n_args = min_n_args; n_args < max_n_args && args[n_args] != NULL; n_args++);
 
        ENTER;
diff --git a/plugins/python-loader/python-loader.c b/plugins/python-loader/python-loader.c
index dbd7e23..ae678be 100644
--- a/plugins/python-loader/python-loader.c
+++ b/plugins/python-loader/python-loader.c
@@ -479,7 +479,7 @@ call_python_function_args (GnmFuncEvalInfo *ei, GnmValue const * const *args)
                                              (gchar *) gnm_func_get_name (fndef, FALSE));
        g_assert (fn_info_tuple != NULL);
        python_fn = PyTuple_GetItem (fn_info_tuple, 2);
-       function_def_count_args (fndef, &min_n_args, &max_n_args);
+       gnm_func_count_args (fndef, &min_n_args, &max_n_args);
        for (n_args = min_n_args; n_args < max_n_args && args[n_args] != NULL; n_args++) {
                ;
        }
diff --git a/plugins/qpro/qpro-read.c b/plugins/qpro/qpro-read.c
index e2e260e..3069680 100644
--- a/plugins/qpro/qpro-read.c
+++ b/plugins/qpro/qpro-read.c
@@ -358,7 +358,7 @@ dump_missing_functions (void)
                                continue;
                        }
 
-                       function_def_count_args (f, &dummy, &dummy);
+                       gnm_func_count_args (f, &dummy, &dummy);
 
                        g_warning ("Function %s has args %s.",
                                   name, f->arg_names ? f->arg_names : "?");
diff --git a/src/dialogs/dialog-formula-guru.c b/src/dialogs/dialog-formula-guru.c
index 95888fa..a69a921 100644
--- a/src/dialogs/dialog-formula-guru.c
+++ b/src/dialogs/dialog-formula-guru.c
@@ -320,7 +320,7 @@ dialog_formula_guru_adjust_children (GtkTreeIter *parent, GnmFunc const *fd,
                                            MAX_ARG, 0,
                                            -1);
                }
-               arg_name = function_def_get_arg_name (fd, i);
+               arg_name = gnm_func_get_arg_name (fd, i);
                if (i >= min_arg && arg_name != NULL) {
                        char *mod_name = g_strdup_printf (_("[%s]"), arg_name);
                        g_free (arg_name);
@@ -330,7 +330,7 @@ dialog_formula_guru_adjust_children (GtkTreeIter *parent, GnmFunc const *fd,
                gtk_tree_store_set (state->model, &iter,
                                    ARG_NAME, arg_name,
                                    ARG_TOOLTIP, gnm_func_get_arg_description (fd, i),
-                                   ARG_TYPE, function_def_get_arg_type_string (fd, i),
+                                   ARG_TYPE, gnm_func_get_arg_type_string (fd, i),
                                    -1);
                g_free (arg_name);
        }
@@ -408,7 +408,7 @@ dialog_formula_guru_load_fd (GtkTreePath *path, GnmFunc *fd,
                gtk_tree_path_free (new_path);
        }
 
-       function_def_count_args (fd, &min_arg, &max_arg);
+       gnm_func_count_args (fd, &min_arg, &max_arg);
 
        gtk_tree_store_set (state->model, &iter,
                            FUN_ARG_ENTRY, "",
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index 1499901..15a00e2 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -698,7 +698,7 @@ make_expr_example (Sheet *sheet, const char *text, gboolean localized)
                        if (at != NULL) { ADD_BOLD_TEXT(t, at - t); t = at + 1; } else {ADD_TEXT (t); 
break;}}}
 #define FINISH_ARGS if (seen_args && !args_finished) {\
        gint min, max; \
-       function_def_count_args (func, &min, &max);\
+       gnm_func_count_args (func, &min, &max);\
                if (max == G_MAXINT) {  \
                        ADD_BOLD_TEXT(UNICODE_ELLIPSIS, strlen(UNICODE_ELLIPSIS)); \
                        ADD_LTEXT("\n",1);                              \
diff --git a/src/func.c b/src/func.c
index 473e6f4..4ff8e8b 100644
--- a/src/func.c
+++ b/src/func.c
@@ -243,12 +243,12 @@ extract_arg_types (GnmFunc *def)
 {
        int i;
 
-       function_def_count_args (def,
-                                &def->fn.args.min_args,
-                                &def->fn.args.max_args);
+       gnm_func_count_args (def,
+                            &def->fn.args.min_args,
+                            &def->fn.args.max_args);
        def->fn.args.arg_types = g_malloc (def->fn.args.max_args + 1);
        for (i = 0; i < def->fn.args.max_args; i++)
-               def->fn.args.arg_types[i] = function_def_get_arg_type (def, i);
+               def->fn.args.arg_types[i] = gnm_func_get_arg_type (def, i);
        def->fn.args.arg_types[i] = 0;
 }
 
@@ -810,8 +810,7 @@ gnm_func_get_name (GnmFunc const *func, gboolean localized)
  * gnm_func_get_description:
  * @fn_def: the fn defintion
  *
- * Return value: the description of the function
- *
+ * Returns: (transfer none): the description of the function
  **/
 char const*
 gnm_func_get_description (GnmFunc const *fn_def)
@@ -836,21 +835,16 @@ gnm_func_get_description (GnmFunc const *fn_def)
 }
 
 /**
- * function_def_count_args:
+ * gnm_func_count_args:
  * @fn_def: pointer to function definition
- * @min: pointer to min. args
- * @max: pointer to max. args
- *
- * This calculates the max and min args that
- * can be passed; NB max can be G_MAXINT for
- * a vararg function.
- * NB. this data is not authoratitive for a
- * 'nodes' function.
+ * @min: (out): location for mininum args
+ * @max: (out): location for mininum args
  *
+ * This calculates the maximum and minimum number of args tha can be passed.
+ * For a vararg function, the maximum will be set to G_MAXINT.
  **/
 void
-function_def_count_args (GnmFunc const *fn_def,
-                         int *min, int *max)
+gnm_func_count_args (GnmFunc const *fn_def, int *min, int *max)
 {
        char const *ptr;
        int   i;
@@ -889,14 +883,14 @@ function_def_count_args (GnmFunc const *fn_def,
 }
 
 /**
- * function_def_get_arg_type:
+ * gnm_func_get_arg_type:
  * @fn_def: the fn defintion
  * @arg_idx: zero based argument offset
  *
- * Return value: the type of the argument
+ * Returns: the type of the argument
  **/
 char
-function_def_get_arg_type (GnmFunc const *fn_def, int arg_idx)
+gnm_func_get_arg_type (GnmFunc const *fn_def, int arg_idx)
 {
        char const *ptr;
 
@@ -928,17 +922,17 @@ function_def_get_arg_type (GnmFunc const *fn_def, int arg_idx)
 }
 
 /**
- * function_def_get_arg_type_string:
+ * gnm_func_get_arg_type_string:
  * @fn_def: the fn defintion
  * @arg_idx: zero based argument offset
  *
- * Return value: the type of the argument as a string
+ * Return value: (transfer none): the type of the argument as a string
  **/
 char const *
-function_def_get_arg_type_string (GnmFunc const *fn_def,
+gnm_func_get_arg_type_string (GnmFunc const *fn_def,
                                  int arg_idx)
 {
-       switch (function_def_get_arg_type (fn_def, arg_idx)) {
+       switch (gnm_func_get_arg_type (fn_def, arg_idx)) {
        case 'f':
                return _("Number");
        case 's':
@@ -964,14 +958,14 @@ function_def_get_arg_type_string (GnmFunc const *fn_def,
 }
 
 /**
- * function_def_get_arg_name:
+ * gnm_func_get_arg_name:
  * @fn_def: the fn defintion
  * @arg_idx: zero based argument offset
  *
- * Return value: the name of the argument (must be freed)
+ * Returns: (transfer full): the name of the argument
  **/
 char *
-function_def_get_arg_name (GnmFunc const *fn_def, guint arg_idx)
+gnm_func_get_arg_name (GnmFunc const *fn_def, guint arg_idx)
 {
        g_return_val_if_fail (fn_def != NULL, NULL);
 
@@ -989,7 +983,7 @@ function_def_get_arg_name (GnmFunc const *fn_def, guint arg_idx)
  * @fn_def: the fn defintion
  * @arg_idx: zero based argument offset
  *
- * Return value: the namedescription of the argument
+ * Returns: (transfer none): the description of the argument
  **/
 char const*
 gnm_func_get_arg_description (GnmFunc const *fn_def, guint arg_idx)
diff --git a/src/func.h b/src/func.h
index 4a82e22..31b938c 100644
--- a/src/func.h
+++ b/src/func.h
@@ -255,13 +255,13 @@ void        gnm_func_upgrade_placeholder
 
 /* TODO */
 char const *gnm_func_get_description (GnmFunc const *fn_def);
-void        function_def_count_args    (GnmFunc const *fn_def,
+void        gnm_func_count_args    (GnmFunc const *fn_def,
                                         gint *min, int *max);
-char        function_def_get_arg_type  (GnmFunc const *fn_def,
+char        gnm_func_get_arg_type  (GnmFunc const *fn_def,
                                         gint arg_idx);
-char const *function_def_get_arg_type_string  (GnmFunc const *fn_def,
+char const *gnm_func_get_arg_type_string  (GnmFunc const *fn_def,
                                         gint arg_idx);
-char       *function_def_get_arg_name  (GnmFunc const *fn_def,
+char       *gnm_func_get_arg_name  (GnmFunc const *fn_def,
                                         guint arg_idx);
 char const *gnm_func_get_arg_description (GnmFunc const *fn_def,
                                         guint arg_idx);
diff --git a/src/sstest.c b/src/sstest.c
index 3eeb52f..4b7b81f 100644
--- a/src/sstest.c
+++ b/src/sstest.c
@@ -533,7 +533,7 @@ function_dump_defs (char const *filename, int dump_type)
                                }
                        }
 
-                       function_def_count_args (fd, &min, &max);
+                       gnm_func_count_args (fd, &min, &max);
                        if (max == G_MAXINT)
                                fprintf (output_file,
                                         "@SYNTAX=%s," UNICODE_ELLIPSIS ")\n",
@@ -961,7 +961,7 @@ check_argument_refs (const char *text, GnmFunc const *fd)
                argname = g_strndup (at + 2, text - at - 2);
 
                for (i = 0; TRUE; i++) {
-                       char *thisarg = function_def_get_arg_name (fd, i);
+                       char *thisarg = gnm_func_get_arg_name (fd, i);
                        gboolean found;
                        if (!thisarg) {
                                g_free (argname);
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index 8967261..484284a 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -857,7 +857,7 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd, gint args, gboolean had_stuff)
        const char *fdname;
 
        gnm_func_load_if_stub (fd);
-       function_def_count_args (fd, &min, &max);
+       gnm_func_count_args (fd, &min, &max);
 
        if ((gee->tooltip.fd)
            && (gee->tooltip.fd == fd && gee->tooltip.args == args
@@ -874,7 +874,7 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd, gint args, gboolean had_stuff)
        g_string_append_c (str, '(');
 
        for (i = 0; i < max; i++) {
-               char *arg_name = function_def_get_arg_name
+               char *arg_name = gnm_func_get_arg_name
                        (fd, i);
                if (arg_name != NULL) {
                        if (first)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]