On 9/5/21 1:18 PM, newbie nullzwei via gnumeric-list wrote:
>
> hello @all,
>
> i'm not a coder but trying to adapt some routines for small improvements
> in rounding and am stuck at the following point:
>
> in functions.c i have the routine? function? 'gnumeric_rounddown',
>
> i'd like to call that function from inside the function 'gnumeric_round'
> and compare the results.
>
> i can call subroutines from goffice, but for those of gnumeric i have no
> idea.
>
> simple call failed with 'implicit declaration',
>
> putting a #define in numbers.h resulted in 'type conflicts' 'double' vs.
> 'GnmFuncEvalInfo',
>
> i could - but don't want to - copy the code from rounddown and paste it
> into round (with modifications),
>
> i could - but dont want to - move more functionality of rounddown into
> goffice (did such with oher calculations and now am able to call them as
> subroutines),
>
> but i think there should be a more elegant way,
>
> and one which complies with gnumeric coding style,
>
> if available a hint to a sample where such is done with other
> calculations could be enough, i'm weak in coding but somewhat better in
> copying and adapting ...
>
> TIA for any help or tip ...
Though I haven't looked at the code you're talking about, as a C
programmer of some years, I can say this:
To avoid the type mismatch error in many cases, look in the source code
where the function is located (routines in C are better known as
"functions). This is probably in one of the library, but you won't know
until you've looked. So grep for it, i.e.,
grep gnumeric_rounddown *.c
Well, it's possible to have C source files which don't have .c
extension. If that's the case for your code, adjust your search
accordingly.
This may find multiple instances, so look for the one which is a
function declaration. This function declaration will tell you what that
function's arguments are, something like
gnumeric_rounddown(int flag, double itemval, char *clabel)
(Of course all the text after "gnumeric_rounddown" will be different.)
Now, when you call the function "gnumeric_rounddown", it must have the
same data types as shown in that function declaration and in the same
order as the funtion declaration (though there can, in rare instances,
be exceptions, but you probably don't need to worry about that).
If that error you're having then doesn't go away, or if you're unclear
about what I've written, look in a basic C book, or do a web search, for
something like "calling functions".
If all that doesn't fix your basic problem, then I can't say.
hth,
ken
_______________________________________________
gnumeric-list mailing list
gnumeric-list gnome org
https://mail.gnome.org/mailman/listinfo/gnumeric-list