ansi style function args for some function pointers

This commit is contained in:
rlar 2010-07-03 21:27:53 +00:00
parent 463ef4a3b1
commit c30028310b
3 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2010-07-03 Robert Larice
* src/frontend/evaluate.c ,
* src/include/fteparse.h :
ansi style function args for some function pointers
2010-07-03 Robert Larice
* src/ciderlib/support/database.c ,
* src/ciderlib/support/logfile.c ,

View File

@ -58,13 +58,12 @@ ft_evaluate(struct pnode *node)
d = apply_func(node->pn_func, node->pn_left);
else if (node->pn_op) {
if (node->pn_op->op_arity == 1)
d = (struct dvec *)
((*node->pn_op->op_func) (node->pn_left));
d = ((*node->pn_op->op_func.unary) (node->pn_left));
else if (node->pn_op->op_arity == 2) {
if(node->pn_op->op_num == TERNARY)
d = ft_ternary(node);
else
d = (*node->pn_op->op_func) (node->pn_left, node->pn_right);
d = (*node->pn_op->op_func.binary) (node->pn_left, node->pn_right);
}
} else {
fprintf(cp_err, "ft_evaluate: Internal Error: bad node\n");
@ -96,7 +95,7 @@ ft_ternary(struct pnode *node)
struct pnode *arg;
int c;
if(!node->pn_right->pn_op || node->pn_right->pn_op->op_func != op_comma)
if(!node->pn_right->pn_op || node->pn_right->pn_op->op_func.binary != op_comma)
{
fprintf(cp_err, "Error: ft_ternary(), daemons ...\n");
return NULL;

View File

@ -28,7 +28,10 @@ struct op {
int op_num; /* From parser #defines. */
char *op_name; /* Printing name. */
char op_arity; /* One or two. */
struct dvec *(*op_func)(); /* The function to do the work. */
union {
struct dvec *(*unary)(struct pnode *);
struct dvec *(*binary)(struct pnode *, struct pnode *);
} op_func; /* The function to do the work. */
} ;
/* The functions that are available. */