summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-10-07 10:01:31 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-10-07 10:01:31 +0100
commit05428c973211017fd722cb7182b2fdeb2ac39cff (patch)
treea93fab820c09b41101f799a43a42902b8c25c737
parentRemove previously deprecated functions (diff)
downloadslicer-1.4.0.tar.bz2
slicer-1.4.0.tar.xz
slicer-1.4.0.zip
Behave more like a normal compiler (write whole file, not append existing one)slicer-1.4.0
-rw-r--r--slice.jam7
-rw-r--r--slicer/db/Jamfile.jam3
-rw-r--r--slicer/ice/Jamfile.jam1
-rw-r--r--slicer/json/Jamfile.jam1
-rw-r--r--slicer/test/Jamfile.jam30
-rw-r--r--slicer/tool/parser.cpp62
-rw-r--r--slicer/xml/Jamfile.jam1
7 files changed, 43 insertions, 62 deletions
diff --git a/slice.jam b/slice.jam
index 0ea52ba..434e562 100644
--- a/slice.jam
+++ b/slice.jam
@@ -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
;