Commit dc2319e8 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

jump to the new interface.


2002-10-12  Jody Goldberg <jody@gnome.org>

	* src/func-builtin.c (func_builtin_init) : jump to the new interface.

	* src/func.h : some renaming and api cleanup.
	  The big one was
	    s/ModulePluginFunctionInfo/GnmFuncDescriptor/
	  Some extension of that structure to add additional fields (at the
	  end) and api changes to use it pervasively.  This includes
	  placeholders for function flags, and implementation and testing
	  status.

	  Some general cleanup with
	    s/FunctionDefinition/GnmFunc/
	    s/func_lookup_by_name/gnm_func_lookup/
	    s/function_add_placeholder/gnm_func_add_placeholder/
	    s/function_def_get_name/gnm_func_get_name/
	    s/function_def_set_user_data/gnm_func_set_user_data/
	    s/function_def_get_user_data/gnm_func_get_user_data/

	  remove function_add_args vs function_add_nodes and replace them with
	  a GnmFuncDescriptor based gnm_func_add

2002-10-12  Jody Goldberg <jody@gnome.org>

	* src/cellspan.c (row_calc_spans) : some simple optimizations
	  to prune the length we check based on col/row maxima and sparseness.
	  This can be significantly faster when we add per row maxima.

	* src/symbol.c (symbol_install) : use g_warning and table_replace in
	  case of a collison.

	* src/format.c (format_number) : Make utf8 clean

	* src/sheet-control-gui.c (scg_set_panes) : more initial work on
	  supporting h/v only freezing.

2002-10-11  Jody Goldberg <jody@gnome.org>

	* src/libgnumeric.c (gnm_dump_func_defs) : add a flag to indicate
	  dumping def or status
	* src/func.c (function_dump_defs) : ditto.
	* src/main-application.c (main) : add --func-state-dump
parent 2e34771e
......@@ -10,6 +10,7 @@ Release Critical
- figure out why error dialogs at startup get forced behind workbook
- validate expression names to ensure that they are not simple values (eg TRUE)
- check the implementation of seriessum returning NULL seems bad
- find leak of 2 bools and 2 arrays when loading samples/excel/lookfuns.xls
1.2 Targets
-----------
......@@ -48,6 +49,7 @@ UTF-8 :
- Error messages (notably when files names are present).
- Window titles.
- function_category_compare
- format precompile
Pending Patches
---------------
......@@ -108,6 +110,7 @@ Misc stuff that should be fixed
current cell.
: Check xl import of unicode names
: Check scoping changes.
: Is there such a thing as an array formula in a name ?
- can_try_save_to uses access(). That's bogus in a number of ways: (a) it
checks the wrong permissions in the set[gu]id case. (b) It reports the
......
2002-10-12 Christian Neumair <chris@gnome-de.org>
2002-10-12 Jody Goldberg <jody@gnome.org>
* plugins/derivatives/options.c: Fixed function descriptions.
* src/func-builtin.c (func_builtin_init) : jump to the new interface.
* src/func.h : some renaming and api cleanup.
The big one was
s/ModulePluginFunctionInfo/GnmFuncDescriptor/
Some extension of that structure to add additional fields (at the
end) and api changes to use it pervasively. This includes
placeholders for function flags, and implementation and testing
status.
Some general cleanup with
s/FunctionDefinition/GnmFunc/
s/func_lookup_by_name/gnm_func_lookup/
s/function_add_placeholder/gnm_func_add_placeholder/
s/function_def_get_name/gnm_func_get_name/
s/function_def_set_user_data/gnm_func_set_user_data/
s/function_def_get_user_data/gnm_func_get_user_data/
remove function_add_args vs function_add_nodes and replace them with
a GnmFuncDescriptor based gnm_func_add
2002-10-12 Jody Goldberg <jody@gnome.org>
* src/cellspan.c (row_calc_spans) : some simple optimizations
to prune the length we check based on col/row maxima and sparseness.
This can be significantly faster when we add per row maxima.
* src/symbol.c (symbol_install) : use g_warning and table_replace in
case of a collison.
* src/format.c (format_number) : Make utf8 clean
* src/sheet-control-gui.c (scg_set_panes) : more initial work on
supporting h/v only freezing.
2002-10-11 Jody Goldberg <jody@gnome.org>
* src/libgnumeric.c (gnm_dump_func_defs) : add a flag to indicate
dumping def or status
* src/func.c (function_dump_defs) : ditto.
* src/main-application.c (main) : add --func-state-dump
2002-10-11 Morten Welinder <terra@diku.dk>
......
Gnumeric 1.1.10
Andreas:
* Add XHTML exporter
* Fix minor bug in the sort dialog
......@@ -10,6 +9,12 @@ Andreas:
Chris Benedict:
* Do not allow all sheets in a workbook to be deleted.
dorami@bu.iij4u.or.jp:
* Add InputMethod support for better international key support
Hal Ashburner:
* Rework derivative valuation routines
Jody:
* Decrease GAL dependence.
* More work on opencalc importer.
......@@ -34,6 +39,9 @@ Jody:
* Esoteric XL number formats #,,##0,,
* Simplify some dialog code
* Support Dynamic Depends (eg INDIRECT)
* Add AREAS so that we can finally finish off the lookup functions
* Clean up the function registration api
* Make format parsing utf8 clean
Morten:
* Port search center from gal's e-table to gtk's treeview.
......@@ -46,12 +54,6 @@ Morten:
* Improve precision of GEOMEAN and PRODUCT.
* Fix MOD for non-integer (or just huge) args.
dorami@bu.iij4u.or.jp:
* Add InputMethod support for better international key support
Hal Ashburner:
* Rework derivative valuation routines
Nicolas Peninguy:
* Use regexps to classify currency and accounting formats
......
2002-10-12 Christian Neumair <chris@gnome-de.org>
2002-10-12 Jody Goldberg <jody@gnome.org>
* plugins/derivatives/options.c: Fixed function descriptions.
* src/func-builtin.c (func_builtin_init) : jump to the new interface.
* src/func.h : some renaming and api cleanup.
The big one was
s/ModulePluginFunctionInfo/GnmFuncDescriptor/
Some extension of that structure to add additional fields (at the
end) and api changes to use it pervasively. This includes
placeholders for function flags, and implementation and testing
status.
Some general cleanup with
s/FunctionDefinition/GnmFunc/
s/func_lookup_by_name/gnm_func_lookup/
s/function_add_placeholder/gnm_func_add_placeholder/
s/function_def_get_name/gnm_func_get_name/
s/function_def_set_user_data/gnm_func_set_user_data/
s/function_def_get_user_data/gnm_func_get_user_data/
remove function_add_args vs function_add_nodes and replace them with
a GnmFuncDescriptor based gnm_func_add
2002-10-12 Jody Goldberg <jody@gnome.org>
* src/cellspan.c (row_calc_spans) : some simple optimizations
to prune the length we check based on col/row maxima and sparseness.
This can be significantly faster when we add per row maxima.
* src/symbol.c (symbol_install) : use g_warning and table_replace in
case of a collison.
* src/format.c (format_number) : Make utf8 clean
* src/sheet-control-gui.c (scg_set_panes) : more initial work on
supporting h/v only freezing.
2002-10-11 Jody Goldberg <jody@gnome.org>
* src/libgnumeric.c (gnm_dump_func_defs) : add a flag to indicate
dumping def or status
* src/func.c (function_dump_defs) : ditto.
* src/main-application.c (main) : add --func-state-dump
2002-10-11 Morten Welinder <terra@diku.dk>
......
2002-10-12 Christian Neumair <chris@gnome-de.org>
2002-10-12 Jody Goldberg <jody@gnome.org>
* plugins/derivatives/options.c: Fixed function descriptions.
* src/func-builtin.c (func_builtin_init) : jump to the new interface.
* src/func.h : some renaming and api cleanup.
The big one was
s/ModulePluginFunctionInfo/GnmFuncDescriptor/
Some extension of that structure to add additional fields (at the
end) and api changes to use it pervasively. This includes
placeholders for function flags, and implementation and testing
status.
Some general cleanup with
s/FunctionDefinition/GnmFunc/
s/func_lookup_by_name/gnm_func_lookup/
s/function_add_placeholder/gnm_func_add_placeholder/
s/function_def_get_name/gnm_func_get_name/
s/function_def_set_user_data/gnm_func_set_user_data/
s/function_def_get_user_data/gnm_func_get_user_data/
remove function_add_args vs function_add_nodes and replace them with
a GnmFuncDescriptor based gnm_func_add
2002-10-12 Jody Goldberg <jody@gnome.org>
* src/cellspan.c (row_calc_spans) : some simple optimizations
to prune the length we check based on col/row maxima and sparseness.
This can be significantly faster when we add per row maxima.
* src/symbol.c (symbol_install) : use g_warning and table_replace in
case of a collison.
* src/format.c (format_number) : Make utf8 clean
* src/sheet-control-gui.c (scg_set_panes) : more initial work on
supporting h/v only freezing.
2002-10-11 Jody Goldberg <jody@gnome.org>
* src/libgnumeric.c (gnm_dump_func_defs) : add a flag to indicate
dumping def or status
* src/func.c (function_dump_defs) : ditto.
* src/main-application.c (main) : add --func-state-dump
2002-10-11 Morten Welinder <terra@diku.dk>
......
......@@ -27,9 +27,6 @@ c-basic-offset: 8 -*- */
*/
#include <gnumeric-config.h>
#include <gnumeric.h>
#include <glib.h>
#include <math.h>
#include <string.h>
#include "func.h"
......@@ -39,7 +36,10 @@ c-basic-offset: 8 -*- */
#include "value.h"
#include "plugin-util.h"
#include "module-plugin-defs.h"
#include <libgnome/gnome-i18n.h>
#include <math.h>
#include <string.h>
GNUMERIC_MODULE_PLUGIN_INFO_DECL;
......@@ -1693,7 +1693,7 @@ static char const *help_opt_extendible_writer = {
"OPT_BS_RHO, OPT_BS_THETA, OPT_BS_GAMMA")
};
ModulePluginFunctionInfo const derivatives_functions [] = {
GnmFuncDescriptor const derivatives_functions [] = {
{ "opt_bs",
"sfffff|f","call_put_flag, spot, strike, time, rate, volatility, "
"cost_of_carry",
......
......@@ -580,7 +580,7 @@ parse_list_free (GnmExprList **list)
static gboolean
make_function (GnmExprList **stack, int fn_idx, int numargs)
{
FunctionDefinition *name = NULL;
GnmFunc *name = NULL;
if (fn_idx == 0xff) {
/*
......@@ -612,9 +612,9 @@ make_function (GnmExprList **stack, int fn_idx, int numargs)
}
/* FIXME : Add support for workbook local functions */
name = func_lookup_by_name (f_name, NULL);
name = gnm_func_lookup (f_name, NULL);
if (name == NULL)
name = function_add_placeholder (f_name, "");
name = gnm_func_add_placeholder (f_name, "", TRUE);
gnm_expr_unref (tmp);
parse_list_push (stack, gnm_expr_new_funcall (name, args));
......@@ -644,9 +644,9 @@ make_function (GnmExprList **stack, int fn_idx, int numargs)
args = parse_list_last_n (stack, numargs);
if (fd->prefix) {
name = func_lookup_by_name (fd->prefix, NULL);
name = gnm_func_lookup (fd->prefix, NULL);
if (name == NULL)
name = function_add_placeholder (fd->prefix, "Builtin ");
name = gnm_func_add_placeholder (fd->prefix, "Builtin ", FALSE);
}
/* This should not happen */
if (!name) {
......
......@@ -176,7 +176,7 @@ ms_formula_build_pre_data (ExcelSheet *sheet, GnmExpr const *tree)
{
GnmExprList *l;
FormulaCacheEntry *fce;
const gchar *name = function_def_get_name (tree->func.func);
const gchar *name = gnm_func_get_name (tree->func.func);
for (l = tree->func.arg_list; l; l = l->next)
ms_formula_build_pre_data (sheet, l->data);
......@@ -589,11 +589,11 @@ write_node (PolishData *pd, GnmExpr const *tree, int paren_level)
FormulaCacheEntry *fce;
fce = get_formula_index (pd->sheet,
function_def_get_name (tree->func.func));
gnm_func_get_name (tree->func.func));
if (fce)
write_funcall (pd, fce, tree);
else {
gchar const *name = function_def_get_name (tree->func.func);
gchar const *name = gnm_func_get_name (tree->func.func);
gchar *err = g_strdup_printf ("Untranslatable '%s'", name);
#if FORMULA_DEBUG > 0
printf ("Untranslatable function '%s'\n", name);
......
......@@ -1476,7 +1476,7 @@ gnumeric_imsum (FunctionEvalInfo *ei, GnmExprList *expr_node_list)
/***************************************************************************/
const ModulePluginFunctionInfo complex_functions[] = {
GnmFuncDescriptor const complex_functions[] = {
{ "complex", "ff|s", "real,im[,suffix]", &help_complex,
gnumeric_complex, NULL, NULL, NULL },
{ "imabs", "?", "inumber", &help_imabs,
......
......@@ -768,7 +768,7 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const ModulePluginFunctionInfo database_functions[] = {
const GnmFuncDescriptor database_functions[] = {
{ "daverage", "r?r", "database,field,criteria",
&help_daverage, gnumeric_daverage, NULL, NULL, NULL },
{ "dcount", "r?r", "database,field,criteria",
......
......@@ -1304,7 +1304,7 @@ gnumeric_weeknum (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const ModulePluginFunctionInfo datetime_functions[] = {
const GnmFuncDescriptor datetime_functions[] = {
{ "date", "fff", "year,month,day", &help_date,
gnumeric_date, NULL, NULL, NULL },
{ "unix2date", "f", "unixtime", &help_unix2date,
......
......@@ -1152,7 +1152,7 @@ gnumeric_gestep (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const ModulePluginFunctionInfo engineering_functions[] = {
const GnmFuncDescriptor engineering_functions[] = {
{ "besseli", "ff", "xnum,ynum", &help_besseli,
gnumeric_besseli, NULL, NULL, NULL },
{ "besselk", "ff", "xnum,ynum", &help_besselk,
......
......@@ -3703,7 +3703,7 @@ gnumeric_vdb (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const ModulePluginFunctionInfo financial_functions[] = {
const GnmFuncDescriptor financial_functions[] = {
{ "accrint", "???fff|f",
"issue,first_interest,settlement,rate,par,frequency[,basis]",
&help_accrint, gnumeric_accrint, NULL, NULL, NULL },
......
......@@ -1820,7 +1820,7 @@ gnumeric_getenv (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const ModulePluginFunctionInfo info_functions[] = {
const GnmFuncDescriptor info_functions[] = {
{ "cell", "sr", N_("info_type, cell"), &help_cell,
gnumeric_cell, NULL, NULL, NULL },
{ "countblank", "r", N_("range"), &help_countblank,
......
......@@ -355,7 +355,7 @@ gnumeric_false (FunctionEvalInfo *ei, Value **args)
/***************************************************************************/
const ModulePluginFunctionInfo logical_functions[] = {
const GnmFuncDescriptor logical_functions[] = {
{ "and", 0, N_("number,number,"), &help_and, NULL,
gnumeric_and, NULL, NULL },
{ "or", 0, N_("number,number,"), &help_or, NULL,
......
......@@ -1179,7 +1179,7 @@ gnumeric_transpose (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const ModulePluginFunctionInfo lookup_functions[] = {
const GnmFuncDescriptor lookup_functions[] = {
{ "address", "ff|ffs", N_("row_num,col_num,abs_num,a1,text"),
&help_address, gnumeric_address, NULL, NULL, NULL },
{ "areas", 0, N_("reference"),
......
......@@ -3088,7 +3088,7 @@ gnumeric_sumproduct (FunctionEvalInfo *ei, GnmExprList *args)
/***************************************************************************/
const ModulePluginFunctionInfo math_functions[] = {
const GnmFuncDescriptor math_functions[] = {
{ "abs", "f", N_("number"), &help_abs,
gnumeric_abs, NULL, NULL, NULL },
{ "acos", "f", N_("number"), &help_acos,
......
......@@ -1091,7 +1091,7 @@ gnumeric_simtable (FunctionEvalInfo *ei, GnmExprList *nodes)
/***************************************************************************/
const ModulePluginFunctionInfo random_functions[] = {
const GnmFuncDescriptor random_functions[] = {
{ "rand", "", "", &help_rand,
gnumeric_rand, NULL, NULL, NULL },
{ "randbernoulli", "f", N_("p"), &help_randbernoulli,
......
......@@ -5151,7 +5151,7 @@ gnumeric_laplace (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
const ModulePluginFunctionInfo stat_functions[] = {
const GnmFuncDescriptor stat_functions[] = {
{ "avedev", 0, N_("number,number,"),
&help_avedev, NULL, gnumeric_avedev, NULL, NULL },
{ "average", 0, N_("number,number,"),
......
......@@ -1235,7 +1235,7 @@ match_again:
/***************************************************************************/
const ModulePluginFunctionInfo string_functions[] = {
const GnmFuncDescriptor string_functions[] = {
{ "char", "f", N_("number"), &help_char,
gnumeric_char, NULL, NULL, NULL },
{ "clean", "S", N_("text"), &help_clean,
......
......@@ -27,9 +27,9 @@ excel_gb_worksheet_function_deref (GBEvalContext *ec,
gboolean try_deref)
{
ExcelGBWorksheetFunction *funcs = EXCEL_GB_WORKSHEET_FUNCTION (object);
FunctionDefinition *fd;
GnmFunc *fd;
if ((fd = func_lookup_by_name (ref->name, funcs->sheet->workbook))) {
if ((fd = gnm_func_lookup (ref->name, funcs->sheet->workbook))) {
GPtrArray *args = g_ptr_array_new ();
EvalPos ep;
Value *ret;
......
......@@ -83,7 +83,7 @@ generic_marshaller (FunctionEvalInfo *ei, GList *nodes)
g_return_val_if_fail (ei != NULL, NULL);
g_return_val_if_fail (ei->func_def != NULL, NULL);
wd = function_def_get_user_data (ei->func_def);
wd = gnm_func_get_user_data (ei->func_def);
g_return_val_if_fail (wd != NULL, NULL);
{ /* Register Excel objects with GB */
......@@ -116,7 +116,7 @@ generic_marshaller (FunctionEvalInfo *ei, GList *nodes)
args = g_slist_reverse (args);
gb_ans = gbrun_project_invoke (wd->ec, wd->proj, function_def_get_name (ei->func_def), args);
gb_ans = gbrun_project_invoke (wd->ec, wd->proj, gnm_func_get_name (ei->func_def), args);
if (gb_ans)
ans = gb_to_value (gb_ans);
......@@ -159,12 +159,12 @@ register_vb_function (Workbook *opt_workbook,
FunctionCategory *cat,
GBWorkbookData *wd)
{
FunctionDefinition *fndef;
GnmFunc *fndef;
/* FIXME: we need per workbook names */
fndef = function_add_nodes (cat, name, "", NULL, NULL,
generic_marshaller, NULL);
function_def_set_user_data (fndef, wd);
gnm_func_set_user_data (fndef, wd);
}
static gboolean
......
......@@ -154,7 +154,7 @@ plugin_cleanup (void)
}
}
ModulePluginFunctionInfo gdaif_functions[] = {
GnmFuncDescriptor gdaif_functions[] = {
{"execSQL", "ssss", "dsn,username,password,sql", &help_execSQL, &gnumeric_execSQL, NULL, NULL, NULL },
{NULL}
};
......@@ -139,7 +139,7 @@ gnm_guile_catcher (void *data, SCM tag, SCM throw_args)
static Value*
func_marshal_func (FunctionEvalInfo *ei, Value *argv[])
{
FunctionDefinition const *fndef;
GnmFunc const *fndef;
SCM args = SCM_EOL, result, function;
CellRef dummy = { 0, 0, 0, 0 };
EvalPos const *old_eval_pos;
......@@ -153,7 +153,7 @@ func_marshal_func (FunctionEvalInfo *ei, Value *argv[])
fndef = ei->func_call->func;
function_def_count_args (fndef, &min, &max);
function = (SCM) function_def_get_user_data (fndef);
function = (SCM) gnm_func_get_user_data (fndef);
for (i = min - 1; i >= 0; --i)
args = scm_cons (value_to_scm (argv [i], dummy), args);
......@@ -179,10 +179,10 @@ func_marshal_func (FunctionEvalInfo *ei, Value *argv[])
static SCM
scm_register_function (SCM scm_name, SCM scm_args, SCM scm_help, SCM scm_category, SCM scm_function)
{
FunctionDefinition *fndef;
GnmFunc *fndef;
FunctionCategory *cat;
char const **help;
GnmFuncDescriptor desc;
SCM_ASSERT (SCM_NIMP (scm_name) && SCM_STRINGP (scm_name), scm_name, SCM_ARG1, "scm_register_function");
SCM_ASSERT (SCM_NIMP (scm_args) && SCM_STRINGP (scm_args), scm_args, SCM_ARG2, "scm_register_function");
......@@ -193,14 +193,26 @@ scm_register_function (SCM scm_name, SCM scm_args, SCM scm_help, SCM scm_categor
scm_permanent_object (scm_function);
help = g_new (char const *, 1);
desc.fn_name = SCM_CHARS (scm_name);
desc.args = SCM_CHARS (scm_args);
desc.arg_names = NULL;
help, func_marshal_func, NULL);
char const **help;
GnmFuncArgs fn_args;
GnmFuncNodes fn_nodes;
GnmFuncLink linker;
GnmFuncUnlink unlinker;
GnmFuncFlags flags;
GnmFuncImplStatus impl_status;
GnmFuncTestStatus test_status;
gboolean free_strings;
};
*help = g_strdup (SCM_CHARS (scm_help));
cat = function_get_category (SCM_CHARS (scm_category));
fndef = function_add_args (cat, g_strdup (SCM_CHARS (scm_name)),
g_strdup (SCM_CHARS (scm_args)), NULL,
help, func_marshal_func, NULL);
fndef = gnm_func_add (cat, &desc);
function_def_set_user_data (fndef, GINT_TO_POINTER (scm_function));
gnm_func_set_user_data (fndef, GINT_TO_POINTER (scm_function));
return SCM_UNSPECIFIED;
}
......
......@@ -274,7 +274,7 @@ static int
wk1_std_func (GnmExprList **stack, Wk1Func const *f,
guint8 const *data, int col, int row)
{
FunctionDefinition *func = func_lookup_by_name (f->name, NULL);
GnmFunc *func = gnm_func_lookup (f->name, NULL);
int numargs, size;
if (f->args < 0) {
......@@ -286,7 +286,7 @@ wk1_std_func (GnmExprList **stack, Wk1Func const *f,
}
if (func == NULL) {
func = function_add_placeholder (f->name, "Lotus ");
func = gnm_func_add_placeholder (f->name, "Lotus ", FALSE);
puts (cell_coord_name (col, row));
}
parse_list_push_expr (stack, gnm_expr_new_funcall (func,
......
......@@ -392,7 +392,7 @@ mps_write_coefficients (MpsInputContext *ctxt, Sheet *sh,
cell = sheet_cell_fetch (sh, ecol + 1, r);
expr = (GnmExpr *) gnm_expr_new_funcall
(func_lookup_by_name ("SUMPRODUCT", NULL), args);
(gnm_func_lookup ("SUMPRODUCT", NULL), args);
cell_set_expr (cell, expr);
cell_queue_recalc (cell);
......@@ -406,7 +406,7 @@ mps_write_coefficients (MpsInputContext *ctxt, Sheet *sh,
args = (GnmExprList *) g_list_append (NULL, (gpointer) expr);
cell = sheet_cell_fetch (sh, ecol + 4, r);
expr = (GnmExpr *) gnm_expr_new_funcall
(func_lookup_by_name ("ABS", NULL), args);
(gnm_func_lookup ("ABS", NULL), args);
cell_set_expr (cell, expr);
cell_queue_recalc (cell);
......
......@@ -545,7 +545,7 @@ plugin_cleanup (void)
prime_table = NULL;
}
const ModulePluginFunctionInfo num_theory_functions[] = {
const GnmFuncDescriptor num_theory_functions[] = {
{"ithprime", "f", "number", &help_ithprime,
&gnumeric_ithprime, NULL, NULL, NULL },
{"nt_phi", "f", "number", &help_phi,
......@@ -563,7 +563,7 @@ const ModulePluginFunctionInfo num_theory_functions[] = {
{NULL}
};
const ModulePluginFunctionInfo bitwise_functions[] = {
const GnmFuncDescriptor bitwise_functions[] = {
{"bitor", "ff", "A,B", &help_bitor,
&func_bitor, NULL, NULL, NULL },
{"bitxor", "ff", "A,B", &help_bitxor,
......
2002-10-11 Jody Goldberg <jody@gnome.org>
* ext/Gnumeric.xs : modernize a bit and make it compile again
2002-09-30 Jody Goldberg <jody@gnome.org>
* Release 1.1.9
......
......@@ -64,11 +64,11 @@ perl2value(SV *sv)
{
Value *v = NULL;
if (SvIOK(sv)){
v = value_new_int ((gnum_int) SvIV(sv));
} else if (SvNOK(sv)) {
if (SvIOK(sv))
v = value_new_int (SvIV(sv));
else if (SvNOK(sv))
v = value_new_float ((gnum_float) SvNV(sv));
} else if (SvPOK(sv)) {
else if (SvPOK(sv)) {
STRLEN size;
gchar *s,*tmp;
......@@ -88,7 +88,7 @@ static Value *
marshal_func (FunctionEvalInfo *ei, Value *argv[])
{
dSP;
FunctionDefinition const *fndef =
GnmFunc const *func =
gnm_expr_get_func_def ((GnmExpr const *)ei->func_call);
GList *l;
I32 r;
......@@ -101,14 +101,14 @@ marshal_func (FunctionEvalInfo *ei, Value *argv[])
SAVETMPS;
PUSHMARK(sp);
function_def_count_args (fndef, &min, &max);
function_def_count_args (func, &min, &max);
for (i = 0; i < max && argv[i] != NULL; i++) {
XPUSHs(sv_2mortal(value2perl(argv[i])));
}
PUTBACK;
r = perl_call_sv(function_def_get_user_data (fndef), G_SCALAR);
r = perl_call_sv (gnm_func_get_user_data (func), G_SCALAR);
SPAGAIN;
if (r != 1)
croak("uh oh, beter get maco");
......@@ -124,25 +124,35 @@ marshal_func (FunctionEvalInfo *ei, Value *argv[])
}
MODULE = Gnumeric PACKAGE = Gnumeric
PROTOTYPES: ENABLE
void
register_function(name, args, named_args, help1, subref)
char * name
char * args
char * named_args
char * help1
SV * subref
PREINIT:
register_function(name, args, named_args, help, subref)
char *name
char *args
char *named_args
char *help
SV *subref
PREINIT:
FunctionCategory *fncat;
FunctionDefinition *fndef;
char const **help = NULL;
CODE:
GnmFuncDescriptor desc;
GnmFunc *func;
CODE:
fncat = function_get_category ("Perl plugin");
desc.fn_name = name;
desc.args = args;;
desc.arg_names = named_args;
desc.help = (char const **)&help;
desc.fn_args = &marshal_func;
desc.fn_nodes = NULL;
desc.linker = NULL;
desc.unlinker = NULL;
desc.flags = 0;
desc.impl_status = GNM_FUNC_IMPL_STATUS_NOT_IN_EXCEL;
desc.test_status = GNM_FUNC_TEST_STATUS_UNKNOWN;
func = gnm_func_add (fncat, &desc);
gnm_func_set_user_data (func, newSVsv (subref));
if (help1) {
help = g_new (char const *, 1);
*help = g_strdup (help1);
}
fndef = function_add_args (fncat, g_strdup(name), g_strdup(args),
g_strdup (named_args), help, marshal_func);
function_def_set_user_data (fndef, newSVsv(subref));
......@@ -125,7 +125,7 @@ Module Gnumeric:
PyCObject_AsVoidPtr (GNUMERIC_MODULE_GET ("Gnumeric_eval_pos")))
PyObject *
python_call_gnumeric_function (FunctionDefinition *fn_def, const EvalPos *opt_eval_pos, PyObject *args)
python_call_gnumeric_function (GnmFunc *fn_def, const EvalPos *opt_eval_pos, PyObject *args)
{
gint n_args, i;
Value **values, *ret_val;
......@@ -1640,7 +1640,7 @@ PyTypeObject py_Workbook_object_type = {
typedef struct _py_GnumericFunc_object py_GnumericFunc_object;
struct _py_GnumericFunc_object {
PyObject_HEAD
FunctionDefinition *fn_def;
GnmFunc *fn_def;
EvalPos *eval_pos;
};
......@@ -1655,13 +1655,13 @@ py_GnumericFunc_call (py_GnumericFunc_object *self, PyObject *args, PyObject *ke