#include "structures.h" /* ============================================================ | plus() | |----------------------------------------------------------| | Params : 1)an integer representing the number of arguments | 2)an array of terms | | Desc : adds the numbers | | | | Returns: a term representing the sum of the numbers | |==========================================================| */ struct term *plus(int arity, struct term **args) { int i; int sum=0; for (i=0;iterm_type!=INTEGER) return NULL; else sum=sum+args[i]->functor; } return maketerm(INTEGER, sum,0,NULL,NULL); } /* ============================================================ | now() | |----------------------------------------------------------| | Params : 1) | | | | Returns:a term representing the current time | |==========================================================| */ struct term *now(int arity, struct term **args) { if (arity!=0) return NULL; else return maketerm(INTEGER,time(NULL),0,NULL,NULL); } /***********************************************************************/ /* read_in the automatically generated evaluable_functions.aux file */ #include "evaluable_functions.aux" int evaluable_functions_count= sizeof(eval_functions)/sizeof(EvalFunctionDescriptor); /* ============================================================ | get_eval_function() | |----------------------------------------------------------| | Params : 1)an Integer | | Desc : | | | | Returns: a pointer to the function descriptor for that functor, if one exists. Null otherwise | |==========================================================| */ EvalFunctionDescriptor *get_eval_function(int functor) { int i; for(i=0;i