diff options
-rw-r--r-- | slice.jam | 7 | ||||
-rw-r--r-- | slicer/db/Jamfile.jam | 3 | ||||
-rw-r--r-- | slicer/ice/Jamfile.jam | 1 | ||||
-rw-r--r-- | slicer/json/Jamfile.jam | 1 | ||||
-rw-r--r-- | slicer/test/Jamfile.jam | 30 | ||||
-rw-r--r-- | slicer/tool/parser.cpp | 62 | ||||
-rw-r--r-- | slicer/xml/Jamfile.jam | 1 |
7 files changed, 43 insertions, 62 deletions
@@ -24,8 +24,8 @@ scanner.register slice-scanner : include ; type.set-scanner SLICE : slice-scanner ; generators.register-standard slice.slice2cpp : SLICE : CPP H : <slicer>no ; -generators.register-standard slice.slicer : SLICE : CPP H : <slicer>yes ; -generators.register-standard slice.slicer.pure : SLICE : CPP : <slicer>pure ; +generators.register-standard slice.slicer : SLICE : CPP CPP(slicer-%) H : <slicer>yes ; +generators.register-standard slice.slicer.pure : SLICE : CPP(slicer-%) : <slicer>pure ; toolset.flags slice.slice2cpp INCLUDES <include> ; toolset.flags slice.slice2cpp DLLEXPORT <ice-visibility>public : --dll-export JAM_DLL_PUBLIC ; @@ -44,12 +44,11 @@ actions slice.slice2cpp actions slice.slicer { slice2cpp -I"$(INCLUDES)" --checksum --output-dir $(1[1]:D) $(2) $(DLLEXPORT) $(ALLOWICE[1]) - slicer -I"$(INCLUDES)" $(2) $(1[1]) $(ALLOWICE[1]) + slicer -I"$(INCLUDES)" $(2) $(1[2]) $(ALLOWICE[1]) } actions slice.slicer.pure { - truncate -c -s 0 $(1[1]) slicer -I"$(INCLUDES)" $(2) $(1[1]) $(ALLOWICE[1]) } diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam index 54677a7..ea394ff 100644 --- a/slicer/db/Jamfile.jam +++ b/slicer/db/Jamfile.jam @@ -45,7 +45,6 @@ run testSelect.cpp <implicit-dependency>../slicer//slicer <include>.. <dependency>slicer.sql - <dependency>../test//compilation : testSelect ; @@ -64,7 +63,6 @@ run testInsert.cpp <implicit-dependency>../slicer//slicer <include>.. <dependency>slicer.sql - <dependency>../test//compilation : testInsert ; @@ -84,7 +82,6 @@ run testUpdate.cpp <implicit-dependency>../slicer//slicer <include>.. <dependency>slicer.sql - <dependency>../test//compilation : testUpdate ; diff --git a/slicer/ice/Jamfile.jam b/slicer/ice/Jamfile.jam index d4c6685..75a7844 100644 --- a/slicer/ice/Jamfile.jam +++ b/slicer/ice/Jamfile.jam @@ -33,7 +33,6 @@ run testSpecifics.cpp <library>../test//common <library>../slicer//slicer <include>.. - <dependency>../test//compilation : testSpecifics ; diff --git a/slicer/json/Jamfile.jam b/slicer/json/Jamfile.jam index 05b5228..ef3c9e0 100644 --- a/slicer/json/Jamfile.jam +++ b/slicer/json/Jamfile.jam @@ -35,7 +35,6 @@ run testSpecifics.cpp <library>../test//common <library>../slicer//slicer <include>.. - <dependency>../test//compilation : testSpecifics ; diff --git a/slicer/test/Jamfile.jam b/slicer/test/Jamfile.jam index 47240c3..4046e6f 100644 --- a/slicer/test/Jamfile.jam +++ b/slicer/test/Jamfile.jam @@ -14,8 +14,8 @@ lib boost_date_time ; lib boost_utf : : <name>boost_unit_test_framework ; lib adhocutil : : : : <include>/usr/include/adhocutil ; -generators.register-standard $(__name__).slicer : SLICE : CPP : <slicer>pure ; -generators.override $(__name__).slicer : slice.slicer.pure ; +generators.register-standard $(__name__).slicer : SLICE : CPP CPP(slicer-%) H : <slicer>yes ; +generators.override $(__name__).slicer : slice.slicer ; feature.feature slicerbin : : free dependency ; toolset.flags slicer SLICERBIN <slicerbin> ; toolset.flags slicer INCLUDES <include> ; @@ -23,48 +23,28 @@ toolset.flags slicer ALLOWICE <allow-ice>yes : --ice ; actions slicer bind SLICERBIN { - truncate -c -s 0 $(1[1]) - "$(SLICERBIN)" -I"$(INCLUDES)" $(2) $(1[1]) $(ALLOWICE[1]) --headerPrefix="\"\"" + slice2cpp -I"$(INCLUDES)" --checksum --output-dir $(1[1]:D) $(2) --dll-export JAM_DLL_PUBLIC $(ALLOWICE[1]) + "$(SLICERBIN)" -I"$(INCLUDES)" $(2) $(1[2]) $(ALLOWICE[1]) --headerPrefix="\"\"" } -lib typesice : - [ glob *.ice ] - : - <slicer>no - <include>. - <include>included - <library>pthread - <library>Ice - <library>IceUtil - <library>included//included - <implicit-dependency>included//included - : : - <library>pthread - <library>Ice - <library>IceUtil - ; - lib types : [ glob *.ice ] conversions.cpp : <dependency>../tool//slicer - <slicer>pure + <slicer>yes <slicerbin>../tool//slicer <include>. <library>adhocutil - <library>typesice <library>boost_date_time <library>included//included <library>../slicer//slicer - <implicit-dependency>typesice <implicit-dependency>included//included <implicit-dependency>../slicer//slicer : : <include>. <library>included//included <library>../slicer//slicer - <library>typesice ; path-constant me : . ; diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index a15fb34..f8ec87b 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -589,48 +589,56 @@ namespace Slicer { throw CompilerError("Both file handle and path provided."); } FilePtr cppfile( - cpp || cppPath.empty() ? cpp : fopen(cppPath.string(), "a"), + cpp || cppPath.empty() ? cpp : fopen(cppPath.string(), "w"), cppPath.empty() ? fflush : fclose); if (!cppfile && !cppPath.empty()) { throw CompilerError("Failed to open output file"); } - cpp = cppfile.get(); - Slicer::Slicer::Args args; - // Copy includes to args - for(const auto & include : includes) { - args.push_back("-I" + include.string()); - } + try { + cpp = cppfile.get(); + Slicer::Slicer::Args args; + // Copy includes to args + for(const auto & include : includes) { + args.push_back("-I" + include.string()); + } - Slice::PreprocessorPtr icecpp = Slice::Preprocessor::create("slicer", slicePath.string(), args); - FILE * cppHandle = icecpp->preprocess(false); + Slice::PreprocessorPtr icecpp = Slice::Preprocessor::create("slicer", slicePath.string(), args); + FILE * cppHandle = icecpp->preprocess(false); - if (cppHandle == NULL) { - throw CompilerError("preprocess failed"); - } + if (cppHandle == NULL) { + throw CompilerError("preprocess failed"); + } - Slice::UnitPtr u = Slice::Unit::createUnit(false, false, allowIcePrefix, false); + Slice::UnitPtr u = Slice::Unit::createUnit(false, false, allowIcePrefix, false); - int parseStatus = u->parse(slicePath.string(), cppHandle, false); + int parseStatus = u->parse(slicePath.string(), cppHandle, false); - if (!icecpp->close()) { - throw CompilerError("preprocess close failed"); - } + if (!icecpp->close()) { + throw CompilerError("preprocess close failed"); + } - if (parseStatus == EXIT_FAILURE) { - throw CompilerError("unit parse failed"); - } + if (parseStatus == EXIT_FAILURE) { + throw CompilerError("unit parse failed"); + } - unsigned int initial = Components(); + unsigned int initial = Components(); - u->visit(this, false); + u->visit(this, false); - u->destroy(); + u->destroy(); - if (!cppPath.empty()) { - cpp = NULL; - } + if (!cppPath.empty()) { + cpp = NULL; + } - return Components() - initial; + return Components() - initial; + } + catch (...) { + if (!cppPath.empty()) { + unlink(cppPath.c_str()); + } + throw; + } } Slicer::ConversionSpec::ConversionSpec(const Slicer::Args & s) : diff --git a/slicer/xml/Jamfile.jam b/slicer/xml/Jamfile.jam index d16fc8a..e9bcec4 100644 --- a/slicer/xml/Jamfile.jam +++ b/slicer/xml/Jamfile.jam @@ -37,7 +37,6 @@ run testSpecifics.cpp <library>../test//common <library>../slicer//slicer <include>.. - <dependency>../test//compilation : testSpecifics ; |