After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 587156 - Convert functions to new function format.
Convert functions to new function format.
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Documentation
git master
Other All
: Normal normal
: ---
Assigned To: Adrian Custer
Jody Goldberg
: 122090 134089 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-06-27 22:20 UTC by Andreas J. Guelzow
Modified: 2009-08-17 16:46 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas J. Guelzow 2009-06-27 22:20:10 UTC
We had a new function format for years. We really should move there (and de-facto) get rid of the old one.
Comment 1 Andreas J. Guelzow 2009-06-27 22:20:35 UTC
*** Bug 122090 has been marked as a duplicate of this bug. ***
Comment 2 Andreas J. Guelzow 2009-06-27 22:21:07 UTC
*** Bug 134089 has been marked as a duplicate of this bug. ***
Comment 3 Andreas J. Guelzow 2009-06-27 22:32:44 UTC
Let's see which ones have been done already:

fn-r
fn-stats
fn-tsa

and partially:

fn-info (1)
fn-logical (1)
fn-lookup (2)
fn-math (15)

and not at-all:

derivatives   (why isn't this called fn-derivatives?)
fn-complex
fn-database
fn-date
fn-eng
fn-erlang
fn-financial
fn-random
fn-string
gda
numtheory
perl-loader
python-loader
sample_datasource
func-builtin
Comment 4 Morten Welinder 2009-06-28 14:24:15 UTC
func-builtin is partial.

If you start this, just assume the "=FOO(42)" example code already works
as discussed.

I'm swamped with configuration code right now.
Comment 5 Andreas J. Guelzow 2009-06-29 01:34:28 UTC
func-builtin and fn-erlang are done (they were small ones)
Comment 6 Andreas J. Guelzow 2009-06-29 03:42:28 UTC
numtheory is done
Comment 7 Andreas J. Guelzow 2009-07-01 00:58:08 UTC
fn_math is done. 

This leaves:

fn-info (partially)
fn-logical (partially)
fn-lookup (partially)
derivatives
fn-complex
fn-database
fn-date
fn-eng
fn-financial
fn-random
fn-string
gda
perl-loader
python-loader
sample_datasource

Comment 8 Morten Welinder 2009-07-01 02:09:05 UTC
sample_datasource done
Comment 9 Morten Welinder 2009-07-01 02:37:28 UTC
fn-logical done.
Comment 10 Andreas J. Guelzow 2009-07-01 04:07:36 UTC
fn-complex is done
Comment 11 Andreas J. Guelzow 2009-07-01 20:28:02 UTC
fn-eng is done.

This leaves:

fn-info (partially)
fn-lookup (partially)
derivatives
fn-database
fn-date
fn-financial
fn-random
fn-string
gda
perl-loader
python-loader


I will be doing fn-random next.



Comment 12 Andreas J. Guelzow 2009-07-03 07:37:57 UTC
fn-random is done
Comment 13 Andreas J. Guelzow 2009-07-03 19:44:08 UTC
fn-string is done

This leaves:

fn-info (partially)
fn-lookup (partially)
derivatives
fn-database
fn-date
fn-financial
gda
perl-loader
python-loader

Comment 14 Andreas J. Guelzow 2009-07-03 19:55:18 UTC
The perl loader doesn't really contain any translatable function description (other than the template) but uses GNM_FUNC_HELP_OLD to load external descriptions. Changing that is not part of this bug.

The same applies to python-loader. So we are really left with

fn-info (partially)
fn-lookup (partially)
derivatives
fn-database
fn-date
fn-financial
gda
Comment 15 Andreas J. Guelzow 2009-07-03 20:15:36 UTC
gda is done
Comment 16 Morten Welinder 2009-07-03 21:27:42 UTC
I'll do fn-date.
Comment 17 Andreas J. Guelzow 2009-07-03 21:44:53 UTC
I'll do fn-info.
Comment 18 Morten Welinder 2009-07-03 23:55:14 UTC
fn-date partially done.

Some of the strings function examples need to be marked for translation,
or alternatively, changed to not use English word in strings.

        { GNM_FUNC_HELP_EXAMPLES, "=EXACT(\"key\",\"key\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=EXACT(\"key\",\"Key\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=UPPER(\"cancelled\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=REPLACE(\"testing\",2,3,\"*****\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=T(\"text\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=SUBSTITUTE(\"testing with this test\",\"test\",\"wait\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=SUBSTITUTE(\"testing with this test\",\"test\",\"wait\",1)" },
        { GNM_FUNC_HELP_EXAMPLES, "=SEARCH(\"c\",\"Cancel\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=SEARCH(\"c\",\"Cancel\",2)" },
        { GNM_FUNC_HELP_EXAMPLES, "=SEARCH(\"c*c\",\"Cancel\")" },
        { GNM_FUNC_HELP_EXAMPLES, "=SEARCH(\"c*c\",\"Cancel\",2)" },
Comment 19 Andreas J. Guelzow 2009-07-04 00:12:11 UTC
Translation is probably a bad idea (since we would need to add comments to make sure the translators understand that the words are not important but their structure).

I'll try to think about some generic terms, for example "Cancún" instead of "Cancel".

Comment 20 Andreas J. Guelzow 2009-07-04 18:04:02 UTC
fn-info is done. I have also changed the examples in fn-string not to need translation.

We are left with:

fn-lookup (partially)
derivatives
fn-database
fn-date   (partially)
fn-financial
Comment 21 Morten Welinder 2009-07-04 19:04:26 UTC
We need consistency on whether to end in a period for _NAME and _ARG.
Comment 22 Andreas J. Guelzow 2009-07-04 19:41:46 UTC
Since they are not sentences I tried to be consistent in _not_ using a period. 
Comment 23 Andreas J. Guelzow 2009-07-05 23:03:32 UTC
I'll try fn-database next.
Comment 24 Andreas J. Guelzow 2009-07-06 04:41:37 UTC
fn-database is done.
Comment 25 Morten Welinder 2009-07-06 16:35:45 UTC
If we do not end in periods, what should we do with stuff like this from
fn-r?

	{ GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be returned instead.  This is useful if the result would otherwise underflow to 0.  Defaults to false.") },
Comment 26 Andreas J. Guelzow 2009-07-06 21:03:14 UTC
I have thought of GNM_FUNC_HELP_ARG as a _brief_ description:

 { GNM_FUNC_HELP_ARG, F_("give_log:if true, log of the result will be
returned")}

and any "usefulness" comment would be stated in the _DESCRIPTION or in a _NOTE


Even if we want to end _ARG with a period, I think we should not clutter that description with "usefulness", since we may want to use that argument description as a tooltip in the formula guru.  
Comment 27 Morten Welinder 2009-07-29 00:31:05 UTC
Uping to BLOCKER.  We need this resolved before release.
(Where "resolved" means everything converted and made somewhat consistent.
The translators would not like us to keep changing things.)

I have committed further work on fn-date.
Comment 28 Andreas J. Guelzow 2009-07-29 05:05:17 UTC
Please make a call on the consistency (for example with respect to periods.)
Comment 29 Morten Welinder 2009-07-29 12:50:03 UTC
I have been dropping periods on NAME and ARG.
DESCRIPTIONs have periods.
Comment 30 Morten Welinder 2009-07-30 01:20:34 UTC
fn-date almost done.

I have defined GNM_DATE_BASIS_HELP for use in functions that have calendar
basis.  It may not be the best description possible, but the hope is that
we will have to fix it only in one place.
Comment 31 Morten Welinder 2009-07-30 19:35:18 UTC
fn-date done.
Comment 32 Morten Welinder 2009-08-02 20:17:25 UTC
fn-r should be ok now.
Comment 33 Morten Welinder 2009-08-04 00:40:49 UTC
I have started work on fn-financial.
Comment 34 Andreas J. Guelzow 2009-08-04 00:54:42 UTC
We are left with:

fn-lookup     (partially)
derivatives   (Andreas)
fn-financial  (Morten)
Comment 35 Andreas J. Guelzow 2009-08-05 22:57:26 UTC
derivatives are done (I hope I didn't introduce any errors). We are lef with

fn-lookup     (partially)
fn-financial  (Morten)

Comment 36 Andreas J. Guelzow 2009-08-06 03:16:19 UTC
fn-lookup is done,

so only fn-financial remains
Comment 37 Morten Welinder 2009-08-06 13:53:12 UTC
I'm on it!  Really.
Comment 38 Andreas J. Guelzow 2009-08-06 17:15:33 UTC
I would think of fn-financial as the worst one to do (and the second largest one too!)
Comment 39 Morten Welinder 2009-08-08 00:15:51 UTC
32 more to go...  I'll be done in a week -- or take up residence in the
insane asylum.
Comment 40 Morten Welinder 2009-08-08 13:12:27 UTC
Looks like the perl and python interfaces need some kind of attention too.

# find . -name '*.[chy]' -print  | xargs grep -c HELP_OLD | grep -v ':0'
./plugins/fn-financial/functions.c:25
./plugins/perl-loader/perl-loader.c:1
./plugins/python-loader/python-loader.c:1
./src/func.h:1
./src/func.c:4
./src/dialogs/dialog-function-select.c:1
Comment 41 Andreas J. Guelzow 2009-08-09 01:15:13 UTC
./plugins/perl-loader/perl-loader.c:1
./plugins/python-loader/python-loader.c:1
 in both case the code constructs an old-style descriptions from a description given externally for puthon or perl functions. 

Comment 42 Morten Welinder 2009-08-14 13:47:09 UTC
fn-financial is done.

find . -name '*.[chy]' -print  | xargs grep -c HELP_OLD | grep -v ':0'
./plugins/perl-loader/perl-loader.c:1
./plugins/python-loader/python-loader.c:1
./src/dialogs/dialog-function-select.c:1
./src/func.h:1
./src/func.c:4

We now need to get rid of the above and the old argument list.
Comment 43 Morten Welinder 2009-08-14 14:21:13 UTC
And we need to proof read:

imcsch: Invalid NAME record
bessely: Invalid NAME record
erfc: Invalid NAME record
oct2dec: Invalid NAME record
amorlinc: Invalid NAME record
ddb: Invalid NAME record
error.type: Invalid NAME record
abs: Invalid NAME record
coth: Invalid NAME record
csch: Invalid NAME record
degrees: Invalid NAME record
round: Invalid NAME record
sech: Invalid NAME record
sinh: Invalid NAME record
tanh: Invalid NAME record
Comment 44 Morten Welinder 2009-08-14 14:30:25 UTC
hex2dec: Help for 2 args, but takes 1-1
duration: Help for 7 args, but takes 5-6
euroconvert: Help for 4 args, but takes 3-3
mduration: Help for 7 args, but takes 5-6
opt_2_asset_correlation: Help for 11 args, but takes 12-12
opt_bs_carrycost: Help for 7 args, but takes 7-8
opt_bs_delta: Help for 7 args, but takes 7-8
opt_bs_rho: Help for 7 args, but takes 7-8
opt_bs_theta: Help for 7 args, but takes 7-8
opt_complex_chooser: Help for 10 args, but takes 9-9
countblank: Help for 0 args, but takes 1-1
asin: Help for 0 args, but takes 1-1
randnegbinom: Help for 4 args, but takes 2-2
left: Help for 1 args, but takes 1-2
leftb: Help for 1 args, but takes 1-2
midb: Help for 2 args, but takes 3-3
right: Help for 1 args, but takes 1-2
rightb: Help for 1 args, but takes 1-2
Comment 45 Andreas J. Guelzow 2009-08-14 17:58:10 UTC
I am not sure how we can (and if we even want to) get rid of
./plugins/perl-loader/perl-loader.c:1
./plugins/python-loader/python-loader.c:1

./src/dialogs/dialog-function-select.c:1 is just:
		else if (func->help[0].type == GNM_FUNC_HELP_OLD)
			describe_old_style (description, func);
		else
			describe_new_style (description, func, state->sheet);
and so is trivial to fix but can't be done until GNM_FUNC_HELP_OLD has really disappeared.

./src/func.h:1 contains just the enumeration definition

./src/func.c:4 contains varies places that just handle this enumeration constant.

So all of these changes depend on fixing 
./plugins/perl-loader/perl-loader.c:1
./plugins/python-loader/python-loader.c:1
however we want to do that!?






Comment 46 Andreas J. Guelzow 2009-08-14 18:04:30 UTC
These are interesting:
opt_bs_carrycost: Help for 7 args, but takes 7-8
opt_bs_delta: Help for 7 args, but takes 7-8
opt_bs_rho: Help for 7 args, but takes 7-8
opt_bs_theta: Help for 7 args, but takes 7-8
opt_complex_chooser: Help for 10 args, but takes 9-9

The new docs match the old ones (which apparently did not match the defined number of variables...)
Comment 47 Morten Welinder 2009-08-14 18:06:59 UTC
I killed all references to GNM_FUNC_HELP_OLD.  Eventually, someone will
need to resurrect help for perl/python.
Comment 48 Andreas J. Guelzow 2009-08-14 18:42:12 UTC
I think I fixed:

hex2dec: Help for 2 args, but takes 1-1
opt_2_asset_correlation: Help for 11 args, but takes 12-12
asin: Help for 0 args, but takes 1-1
randnegbinom: Help for 4 args, but takes 2-2
left: Help for 1 args, but takes 1-2
leftb: Help for 1 args, but takes 1-2
midb: Help for 2 args, but takes 3-3
right: Help for 1 args, but takes 1-2
rightb: Help for 1 args, but takes 1-2
Comment 49 Andreas J. Guelzow 2009-08-14 19:03:19 UTC
hmm,

in fn-financial the name records seem to say 
...:calculate ...
for example
{ GNM_FUNC_HELP_NAME, F_("TBILLPRICE:calculate price of a treasury bill")},
elsewhere we didn't start with the verb "calculate" but just said what was calculated:
{ GNM_FUNC_HELP_NAME, F_("TBILLPRICE:price of a treasury bill")},
Comment 50 Andreas J. Guelzow 2009-08-14 19:11:41 UTC
I think I fixed

imcsch: Invalid NAME record
bessely: Invalid NAME record
erfc: Invalid NAME record
oct2dec: Invalid NAME record
amorlinc: Invalid NAME record
ddb: Invalid NAME record
error.type: Invalid NAME record
abs: Invalid NAME record
coth: Invalid NAME record
csch: Invalid NAME record
degrees: Invalid NAME record
round: Invalid NAME record
sech: Invalid NAME record
sinh: Invalid NAME record
tanh: Invalid NAME record
Comment 51 Andreas J. Guelzow 2009-08-14 19:46:42 UTC
Only comment #49 remains.
Comment 52 Morten Welinder 2009-08-14 19:48:58 UTC
we also need to remove the old argument names.
Comment 53 Andreas J. Guelzow 2009-08-14 20:06:41 UTC
and of course we first have to change the formula guru to use the new ones!
Comment 54 Andreas J. Guelzow 2009-08-14 20:11:07 UTC
I was wrong: the function selector uses function_def_get_arg_name.
Comment 55 Andreas J. Guelzow 2009-08-14 21:21:25 UTC
function_def_get_arg_name has been rewritten to not use the arg_names field but the ARG record.
Comment 56 Andreas J. Guelzow 2009-08-14 22:17:06 UTC
I have removed all the old argument names and the argument_names field in GnmFuncDescriptor. We still need to remove the corresponding field from GnmFunc.
Comment 57 Morten Welinder 2009-08-14 23:54:23 UTC
No longer a blocker.
Comment 58 Andreas J. Guelzow 2009-08-17 16:46:57 UTC
The unused arg_names field in GnmFunc has been changed into a ptr array in preparation for providing tooltip information when entering functions.

In the process I also fixed a crasher when theformula guru was invoked on a cell containing an undefined function.

This is now fixed I believe.