void S_gen(char *s) {PA_variable *pp; haelem *hp; hp = SC_hasharr_lookup(PA_gs.variable_tab, s); if (hp != NULL) {pp = (PA_variable *) hp->def; varh(pp);} else if (SC_numstrp(s)) sh(s); return;}
void RFunction::write_class(::std::ostream& out, ::std::string const& name) const { ::std::string varx("x"); ::std::string varh("h"); out << "////////////////////////////////////////////////\n" << "//\n" << "// Code automatically generated by class RFunction\n" << "//\n" << "////////////////////////////////////////////////\n\n\n" << "#include " << '"' << "FunctionAlgebra/RFunction.h" << '"' << "\n\n\n" << "#include " << '"' << "write_code.h" << '"' << "\n" << "class function_algebra_" << name << " : public function_algebra_impl {\n" << "private:\n" << " coord_type derive(const coord_type& x, const coord_type& h) const;\n" << "public:\n" << " function_algebra_" << name << "() {d_Def = " << dDef() << "; d_Im = " << dIm() <<";}\n" << " ::std::string name() const { return " << '"' << "function_algebra_" << name << '"' << ";}\n" << " coord_type eval(const coord_type& x) const;\n" << " ::std::string write_code_eval(::std::ostream& out, int& vnum, ::std::string const& var) const\n" << " {return write_code_eval_libfct(out,vnum,var," << '"' << name << '"' << ");}\n" << " ::std::string write_code_derive(::std::ostream& out, int& vnum,\n" << " ::std::string const& varx, ::std::string const& varh) const\n" << " {return write_code_derive_libfct(out,vnum,varx,varh," << '"' << "d_" << name << '"' << ");}\n" << "};\n\n" << "inline coord_type " << "function_algebra_" << name << "::eval(const coord_type& " << varx << ") const\n" << "{\n"; int vnum = 0; ::std::string result(write_code_eval(out,vnum,varx)); out << "\n return(" << result << ");\n}\n\n"; out << "inline coord_type " << "function_algebra_" << name << "::derive(const coord_type& " << varx << ", const coord_type& " << varh << ") const\n" << "{\n"; vnum = 0; ::std::string d_result(write_code_derive(out,vnum,varx,varh)); out << "\n return(" << d_result << ");\n}\n\n"; }
void readh(char *str) {char *token, s[MAXLINE]; PA_command *cp; haelem *hp; PA_variable *pp; FILE *fp; SC_strncpy(in_deck, MAXLINE, str, -1); fp = fopen(str, "r"); PA_ERR((fp == NULL), "COULDN'T OPEN FILE %s", str); /* dispatch on commands from the deck */ while (TRUE) {if (GETLN(s, MAXLINE, fp) == NULL) {fclose(fp); break;}; if (SC_blankp(s, "c;#")) continue; token = SC_strtok(s, " \n\r\t/(", PA_gs.strtok_p); if (token != NULL) {hp = SC_hasharr_lookup(PA_gs.command_tab, token); if (hp != NULL) {conversion_s = 1.0; cp = (PA_command *) hp->def; (*(cp->handler))(cp);} else if ((hp = SC_hasharr_lookup(PA_gs.variable_tab, token)) != NULL) {pp = (PA_variable *) hp->def; varh(pp);} else if (SC_numstrp(token)) sh(token); else PA_WARN(TRUE,"UNRECOGNIZED TOKEN %s IN FILE %s", token, str);};}; return;}