[Assorted-commits] SF.net SVN: assorted:[1317] clamp/trunk/src
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-03-20 21:16:10
|
Revision: 1317 http://assorted.svn.sourceforge.net/assorted/?rev=1317&view=rev Author: yangzhang Date: 2009-03-20 21:15:44 +0000 (Fri, 20 Mar 2009) Log Message: ----------- added --outdir Modified Paths: -------------- clamp/trunk/src/CodeGen.cc clamp/trunk/src/CodeGen.hh clamp/trunk/src/Makefile clamp/trunk/src/clamp.y Modified: clamp/trunk/src/CodeGen.cc =================================================================== --- clamp/trunk/src/CodeGen.cc 2009-03-20 20:40:27 UTC (rev 1316) +++ clamp/trunk/src/CodeGen.cc 2009-03-20 21:15:44 UTC (rev 1317) @@ -113,14 +113,17 @@ // Constructors //////////////////////////////////////////////////////////////////////// - CodeGen::CodeGen (const string &prefix) + using namespace boost::filesystem; + + CodeGen::CodeGen (const path &outdir, const string &prefix) : mStack () , mLambdaCount (0) - , mImplStream ((prefix + "_lambda_impl.clamp_h").c_str()) - , mGenrStream ((prefix + "_lambda_genr.clamp_h").c_str()) + , mImplStream ((outdir / (prefix + "_lambda_impl.clamp_h")).string().c_str()) + , mGenrStream ((outdir / (prefix + "_lambda_genr.clamp_h")).string().c_str()) , mLambdaMap () , mGeneratorStream () , mPrefix (prefix) + , mOutdir (outdir) { } @@ -732,7 +735,7 @@ { mStack.push (LambdaContext (f, openBracePos, lamp)); - string newName (bodyFileName (++mLambdaCount)); + string newName ((mOutdir / bodyFileName (++mLambdaCount)).string().c_str()); f = fopen (newName.c_str(), "w+"); Modified: clamp/trunk/src/CodeGen.hh =================================================================== --- clamp/trunk/src/CodeGen.hh 2009-03-20 20:40:27 UTC (rev 1316) +++ clamp/trunk/src/CodeGen.hh 2009-03-20 21:15:44 UTC (rev 1317) @@ -31,17 +31,19 @@ #include <fstream> #include <map> #include <sstream> -#include "boost/smart_ptr.hpp" +#include <boost/smart_ptr.hpp> #include <string> +#include <boost/filesystem.hpp> namespace clamp { using namespace std; + using namespace boost::filesystem; class CodeGen { public: - CodeGen (const std::string &prefix); + CodeGen (const path &outdir, const std::string &prefix); public: void lambdaType (FILE *, std::auto_ptr<lambdaT>); @@ -135,6 +137,7 @@ private: std::string mPrefix; + path mOutdir; }; Modified: clamp/trunk/src/Makefile =================================================================== --- clamp/trunk/src/Makefile 2009-03-20 20:40:27 UTC (rev 1316) +++ clamp/trunk/src/Makefile 2009-03-20 21:15:44 UTC (rev 1317) @@ -35,7 +35,7 @@ LFLAGS = YFLAGS = -v -d -LDLIBS = -lboost_program_options-gcc43-mt +LDLIBS = -lboost_program_options-gcc43-mt -lboost_filesystem-gcc43-mt LD = $(CXX) clamp.tab.h: clamp.cc @@ -68,4 +68,4 @@ .PRECIOUS: %.cc %.cc: %.clamp clamp - ./clamp --prefix $(basename $<) <$< >$@ + ./clamp --outdir asdf/ --prefix $(basename $<) <$< >$@ Modified: clamp/trunk/src/clamp.y =================================================================== --- clamp/trunk/src/clamp.y 2009-03-20 20:40:27 UTC (rev 1316) +++ clamp/trunk/src/clamp.y 2009-03-20 21:15:44 UTC (rev 1317) @@ -33,6 +33,7 @@ #include <malloc.h> #include <set> #include <boost/program_options.hpp> +#include <boost/filesystem.hpp> using namespace clamp; using namespace std; @@ -349,22 +350,21 @@ int main (int argc, char *argv[]) { + using namespace boost::filesystem; + int result; string prefix; + path outdir; namespace po = boost::program_options; po::options_description desc("Allowed options"); desc.add_options() - ("help,h", "show this help message") + ("help,h", "show this help message") ("debug,d", "enable yydebug") -#if 0 - ("exit-on-recovery,x", po::bool_switch(&stop_on_recovery), - "exit after the joiner fully recovers (for leader)") - ("batch-size,b", po::value<int>(&batch_size)->default_value(100), - "number of txns to batch up in each msg (for leader)") -#endif - ("prefix,p", po::value<string>(&prefix)->default_value(""), + ("outdir,O", po::value<path>(&outdir), + "directory in which to place the output files") + ("prefix,p", po::value<string>(&prefix), "hostname or address of the leader"); po::variables_map vm; @@ -400,13 +400,13 @@ } #endif - cout << "#include \"" << prefix << "_lambda_impl.clamp_h\"\n"; + cout << "#include \"" << outdir / prefix << "_lambda_impl.clamp_h\"\n"; - gGenPtr = new CodeGen(prefix); + gGenPtr = new CodeGen(outdir, prefix); result = yyparse(); - cout << "#include \"" << prefix << "_lambda_genr.clamp_h\"\n"; + cout << "#include \"" << outdir / prefix << "_lambda_genr.clamp_h\"\n"; if (result == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |