On Sun, 7 Jul 2019, Sven Schreiber wrote:

Am 05.07.2019 um 08:37 schrieb Sven Schreiber:
Am 05.07.2019 um 00:57 schrieb Allin Cottrell:
On Thu, 4 Jul 2019, Sven Schreiber wrote:

Actually if there are no objections about the request maybe that's
something that might be relatively easy to implement, so I might try it
myself.

I have no objection, though it seems to me of low priority.

OK, I'm attaching a diff with which I seem to be able to do things like
"zeros(3)". The only affected file was lib/src/geneval.c.

The most difficult thing was actually to understand that in the eval
function (static NODE *eval...) the existing check r == NULL did not
work and had to be replaced with null_or_empty(r). I still don't really
understand why r isn't NULL there, like it is in the contex of F_IMAT.

Thanks, Sven. I've now committed your changes. They remain to be documented.

I've also rejigged some of the macros we use a lot in geneval.c with the aim of clarifying things a little.

In the eval() switch we should never actually encounter a NULL node -- a skipped argument should show up as a node with EMPTY type. But the check against NULL is there for extra safety. I've renamed "null_or_empty" to "null_node" for brevity.

#define null_node(n) (n == NULL || n->t == EMPTY)

I'm also now using these

#define scalar_node(n) (n->t == NUM || scalar_matrix_node(n))
#define null_or_scalar(n) (null_node(n) || scalar_node(n))
#define null_or_string(n) (null_node(n) || n->t == STR)

to check optional scalar or string arguments, respectively.

Allin
_______________________________________________
Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it
To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/

Reply via email to