void generate_cpp_normal( const std::string& filename, std::ostream& os, Dependency& dependency, const typeset_type& types, const atomset_type& atoms, const Value& v ) { generate_cpp( filename, os, dependency, types, atoms, v, normal_ptr_maker() ); }
/** * Read a Stan model specification from the * specified input, parse it, and write the C++ code for it * to the specified output. * * @param msgs Output stream for warning messages * @param stan_lang_in Stan model specification * @param cpp_out C++ code output stream * @param model_name Name of model class * @param allow_undefined Permit undefined functions? * * @return <code>false</code> if code could not be generated * due to syntax error in the Stan model; * <code>true</code> otherwise. */ bool compile(std::ostream* msgs, std::istream& stan_lang_in, std::ostream& cpp_out, const std::string& model_name, const bool allow_undefined = false) { program prog; bool parsed_ok = parse(msgs, stan_lang_in, model_name, prog, allow_undefined); if (!parsed_ok) return false; // syntax error in program generate_cpp(prog, model_name, cpp_out); return true; }
/** * Read a Stan directed graphical model specification from the * specified input, parse it, and write the C++ code for it * to the specified output. * * @param stan_gm_in Graphical model specification * @param cpp_out C++ code output stream * @param model_name Name of model class * @param include_main Indicates whether to generate a main * function * @param in_file_name Name of input file to use in error * messages; defaults to <code>input</code>. * @return <code>false</code> if code could not be generated * due to syntax error in the Graphical model; * <code>true</code> otherwise. */ bool compile(std::ostream* output_stream, // for warnings std::istream& stan_gm_in, std::ostream& cpp_out, const std::string& model_name, bool include_main = true, const std::string& in_file_name = "input") { program prog; bool parsed_ok = parse(output_stream,stan_gm_in,in_file_name,prog); if (!parsed_ok) return false; // syntax error in program generate_cpp(prog,model_name,cpp_out,include_main); return true; }
int main(int argc, char **argv) { opterr = 0; int c; while ((c = getopt (argc, argv, "o:f:n:C:P:I:")) != -1) switch (c) { case 'o': options.filename = optarg; break; case 'f': options.factor.push_back(optarg); break; case 'n': options.notFactor.push_back(optarg); break; case 'C': options.cell = optarg; break; case 'P': options.ifprefix = optarg; break; default: abort(); } if (optind != argc-1 || options.filename == "" || argc == 0 || options.ifprefix == "") {; printf("Missing \"--o\" option, missing input filenames, missing ifname or missing ifprefix. Run \" importbvi.py -h \" to see available options\n"); exit(-1); } outfile = fopen(options.filename.c_str(), "w"); if (endswith(argv[optind], ".lib")) parse_lib(argv[optind]); else parse_verilator(argv[optind]); regroup_items(); generate_cpp(); return 0; }