/*************************************************************************** functiondecl.cpp - description ------------------- begin : Thu Mar 20 20:47:11 2003 copyright : (C) 2002 by Cavalli Andrea email : cavalli@bioc.unizh.ch **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include #include FunctionDecl::~FunctionDecl(){ delete id; delete args; delete body; } ZObj * FunctionDecl::eval(){ //exec_line done exec_line = line; string name = id->val; map::iterator iter = SYMBOLTABLE.find(name); if(iter!=SYMBOLTABLE.end()){ throw ZError(line,"Re-definition of function: "+name); } vector arg; if(args!=NULL){ for(int i=0;iident_list.size();++i){ arg.push_back(args->ident_list[i]->val); } } //register ZFunction * f = new ZFunction(name,arg,body); SYMBOLTABLE[name]=f; SymbolTable::instance().add_common(name,f); return new ZStatus(true); }