#ifndef STFUNC_H #define STFUNC_H #include #include "value.h" #include "nt.h" using std::string; // Interface function to standard functions in Delta typedef void (*StdFunc)( int numArgs, // actual number of arguments const ValuePtr* args, // array of pointers to arguments Value* res // resulting value ); const int STDFUNC_RES_LVALUE = 1; // First arg and result are the same! class StdFuncDef { public: string name; // function name int numArgs; // (-1) for indefinite number of arguments StdFunc func; // Interface function int modifiers; StdFuncDef(): name(), numArgs(0), func(0), modifiers(0) {} StdFuncDef(const string& n, int nArgs, StdFunc f, int m = 0): name(n), numArgs(nArgs), func(f), modifiers(m) {} bool resIsLValue() const { return ((modifiers & STDFUNC_RES_LVALUE) != 0); } }; // Globals const StdFuncDef* findStandardFunction(const string& name); void addStandardFunctionsToNameTable(NameTable& nt); typedef const StdFuncDef* StdFuncDefPtr; #endif