On Fri, 18 Jul 2008, Allin Cottrell wrote:
On Thu, 17 Jul 2008, Riccardo (Jack) Lucchetti wrote:
> On Thu, 17 Jul 2008, Gordon Hughes wrote:
>
>> By adding the requirement to define additional variables and
>> provide the relevant pointers the function becomes less easy
>> to use for someone who just wants to run a simple estimation
>> and has no requirement for anything beyond the basic printed
>> output.
>
> Point taken. I've just committed to CVS a little modification
> that may help in these cases; Allin, feel free to revert it if
> there's anything wrong with it, but I tested it a little and
> there seem to be no ill side effects (famous last words).
> Basically, the keyword "null" is now a valid value for pointers,
> and can be specified as a default value.
Nothing wrong with it, but actually this was already supported.
The (useful) sample script you gave runs fine without the change
to check_function_args(). The case is handled by the first
condition:
if ((fp->flags & ARG_OPTIONAL) &&
arg->type == GRETL_TYPE_NONE) {
Sorry, I wasn't clear. My idea was to make "null" a valid value for
pointers even when they're not optional. The following script, for
example, would return an error without my little addition:
<script>
function foo(matrix *a)
if isnull(a)
scalar ret = -1
else
scalar ret = rows(a)
endif
return scalar ret
end function
nulldata 8
eval foo(null)
</script>
This is maybe redundant, but probably harmless, isn't it?
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti