aboutsummaryrefslogtreecommitdiff
path: root/dist/examples
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
commit2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 (patch)
tree49c2748443fe3c1f01108756b647440e0647a11b /dist/examples
parent161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff)
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'dist/examples')
-rw-r--r--dist/examples/cxx/hybrid/allocator/makefile81
-rw-r--r--dist/examples/cxx/hybrid/allocator/nmakefile77
-rw-r--r--dist/examples/cxx/hybrid/makefile16
-rw-r--r--dist/examples/cxx/hybrid/nmakefile17
-rw-r--r--dist/examples/cxx/parser/generated/makefile4
-rw-r--r--dist/examples/cxx/parser/generated/nmakefile4
-rw-r--r--dist/examples/cxx/parser/makefile11
-rw-r--r--dist/examples/cxx/parser/nmakefile12
-rw-r--r--dist/examples/cxx/serializer/makefile3
-rw-r--r--dist/examples/cxx/serializer/nmakefile4
10 files changed, 227 insertions, 2 deletions
diff --git a/dist/examples/cxx/hybrid/allocator/makefile b/dist/examples/cxx/hybrid/allocator/makefile
new file mode 100644
index 0000000..d0e2318
--- /dev/null
+++ b/dist/examples/cxx/hybrid/allocator/makefile
@@ -0,0 +1,81 @@
+root := ../../../..
+
+include $(root)/build/cxx/rules.make
+
+# Build.
+#
+EXTRA_CPPFLAGS := -I$(root)/libxsde
+
+EXTRA_XSDFLAGS := --no-stl --no-exceptions --custom-allocator
+
+ifeq ($(XSDE_ENCODING),iso8859-1)
+EXTRA_XSDFLAGS += --char-encoding iso8859-1
+endif
+
+ifeq ($(XSDE_IOSTREAM),n)
+EXTRA_XSDFLAGS += --no-iostream
+endif
+
+ifeq ($(XSDE_LONGLONG),n)
+EXTRA_XSDFLAGS += --no-long-long
+endif
+
+ifeq ($(XSDE_PARSER_VALIDATION),n)
+EXTRA_XSDFLAGS += --suppress-parser-val
+endif
+
+ifeq ($(XSDE_SERIALIZER_VALIDATION),n)
+EXTRA_XSDFLAGS += --suppress-serializer-val
+endif
+
+ifeq ($(XSDE_REUSE_STYLE),mixin)
+EXTRA_XSDFLAGS += --reuse-style-mixin
+endif
+
+ifeq ($(XSDE_POLYMORPHIC),y)
+EXTRA_XSDFLAGS += --runtime-polymorphic
+endif
+
+driver: driver.o arena.o people.o people-pskel.o people-pimpl.o \
+people-sskel.o people-simpl.o $(root)/libxsde/xsde/libxsde.a
+
+driver.o: driver.cxx arena.cxx arena.hxx people.hxx people-pimpl.hxx \
+people-simpl.hxx
+arena.o: arena.cxx arena.hxx
+people.o: people.cxx
+people-pskel.o: people-pskel.cxx
+people-pimpl.o: people-pimpl.cxx
+people-simpl.o: people-simpl.cxx
+people-simpl.o: people-simpl.cxx
+
+.PRECIOUS: %.hxx %.cxx %-pskel.hxx %-pskel.cxx %-pimpl.hxx %-pimpl.cxx \
+%-sskel.hxx %-sskel.cxx %-simpl.hxx %-simpl.cxx
+
+%.hxx %.cxx %-pskel.hxx %-pskel.cxx %-pimpl.hxx %-pimpl.cxx \
+%-sskel.hxx %-sskel.cxx %-simpl.hxx %-simpl.cxx: %.xsd
+ $(root)/bin/xsde cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
+--generate-parser --generate-serializer --generate-aggregate $<
+
+
+# Generate.
+#
+.PHONY: gen
+gen: people.hxx
+
+
+# Test.
+#
+.PHONY: test
+test: driver people.xml
+ ./driver people.xml
+
+# Clean.
+#
+.PHONY: clean cleanobj
+cleanobj:
+ rm -f people-pimpl.o people-pskel.o people-simpl.o people-sskel.o \
+people.o driver.o arena.o driver
+
+clean: cleanobj
+ rm -f people-pimpl.?xx people-pskel.?xx people-simpl.?xx \
+people-sskel.?xx people.?xx
diff --git a/dist/examples/cxx/hybrid/allocator/nmakefile b/dist/examples/cxx/hybrid/allocator/nmakefile
new file mode 100644
index 0000000..908dd7e
--- /dev/null
+++ b/dist/examples/cxx/hybrid/allocator/nmakefile
@@ -0,0 +1,77 @@
+root = ..\..\..\..
+
+!include $(root)\build\cxx\rules.nmake
+
+# Build.
+#
+EXTRA_CPPFLAGS = /I$(root)\libxsde
+
+EXTRA_XSDFLAGS = --no-stl --no-exceptions --custom-allocator
+
+!if "$(XSDE_ENCODING)" == "iso8859-1"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --char-encoding iso8859-1
+!endif
+
+!if "$(XSDE_IOSTREAM)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-iostream
+!endif
+
+!if "$(XSDE_LONGLONG)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-long-long
+!endif
+
+!if "$(XSDE_PARSER_VALIDATION)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --suppress-parser-val
+!endif
+
+!if "$(XSDE_SERIALIZER_VALIDATION)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --suppress-serializer-val
+!endif
+
+!if "$(XSDE_REUSE_STYLE)" == "mixin"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --reuse-style-mixin
+!endif
+
+!if "$(XSDE_POLYMORPHIC)" == "y"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --runtime-polymorphic
+!endif
+
+driver.exe: driver.obj arena.obj people.obj people-pskel.obj people-pimpl.obj \
+people-sskel.obj people-simpl.obj $(root)\libxsde\xsde\xsde.lib
+
+driver.obj: driver.cxx arena.cxx arena.hxx people.hxx people-pimpl.hxx \
+people-simpl.hxx
+arena.obj: arena.cxx arena.hxx
+people.obj: people.cxx
+people-pskel.obj: people-pskel.cxx
+people-pimpl.obj: people-pimpl.cxx
+people-sskel.obj: people-sskel.cxx
+people-simpl.obj: people-simpl.cxx
+
+people.cxx people.hxx \
+people-pskel.cxx people-pskel.hxx people-pimpl.cxx people-pimpl.hxx \
+people-sskel.cxx people-sskel.hxx people-simpl.cxx people-simpl.hxx \
+: people.xsd
+ $(root)\bin\xsde.exe cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
+--generate-parser --generate-serializer --generate-aggregate people.xsd
+
+
+# Generate.
+#
+gen: people.hxx
+
+
+# Test.
+#
+test: driver.exe people.xml
+ .\driver.exe people.xml
+
+# Clean.
+#
+cleanobj:
+ -del people-pimpl.obj people-pskel.obj people-simpl.obj \
+people-sskel.obj people.obj driver.obj arena.obj driver.exe
+
+clean: cleanobj
+ -del people-pimpl.?xx people-pskel.?xx people-simpl.?xx \
+people-sskel.?xx people.?xx
diff --git a/dist/examples/cxx/hybrid/makefile b/dist/examples/cxx/hybrid/makefile
index 3a9ddaa..859451b 100644
--- a/dist/examples/cxx/hybrid/makefile
+++ b/dist/examples/cxx/hybrid/makefile
@@ -2,7 +2,11 @@ root := ../../..
include $(root)/build/config.make
-dirs := binary compositors custom
+dirs :=
+
+ifeq ($(XSDE_CUSTOM_ALLOCATOR),n)
+
+dirs += binary compositors custom
ifeq ($(XSDE_IOSTREAM),y)
ifeq ($(XSDE_EXCEPTIONS),y)
@@ -26,6 +30,16 @@ dirs += minimal
endif
endif
+else # XSDE_CUSTOM_ALLOCATOR
+
+ifeq ($(XSDE_STL),n)
+ifeq ($(XSDE_EXCEPTIONS),n)
+dirs += allocator
+endif
+endif
+
+endif
+
.PHONY: all $(dirs)
diff --git a/dist/examples/cxx/hybrid/nmakefile b/dist/examples/cxx/hybrid/nmakefile
index 8bd74e6..45c57ca 100644
--- a/dist/examples/cxx/hybrid/nmakefile
+++ b/dist/examples/cxx/hybrid/nmakefile
@@ -2,7 +2,11 @@ root = ..\..\..
!include $(root)\build\config.nmake
-dirs = binary compositors custom
+dirs =
+
+!if "$(XSDE_CUSTOM_ALLOCATOR)" == "n"
+
+dirs = $(dirs) binary compositors custom
!if "$(XSDE_IOSTREAM)" == "y"
!if "$(XSDE_EXCEPTIONS)" == "y"
@@ -26,6 +30,17 @@ dirs = $(dirs) minimal
!endif
!endif
+!else # XSDE_CUSTOM_ALLOCATOR
+
+!if "$(XSDE_STL)" == "n"
+!if "$(XSDE_EXCEPTIONS)" == "n"
+dirs = $(dirs) allocator
+!endif
+!endif
+
+!endif
+
+
all:
@for %i in ( $(dirs) ) do \
@cmd /c "echo entering %i && cd %i && $(MAKE) /nologo /f nmakefile" || exit 1
diff --git a/dist/examples/cxx/parser/generated/makefile b/dist/examples/cxx/parser/generated/makefile
index 6f77af4..5335819 100644
--- a/dist/examples/cxx/parser/generated/makefile
+++ b/dist/examples/cxx/parser/generated/makefile
@@ -46,6 +46,10 @@ ifeq ($(XSDE_POLYMORPHIC),y)
EXTRA_XSDFLAGS += --runtime-polymorphic
endif
+ifeq ($(XSDE_CUSTOM_ALLOCATOR),y)
+EXTRA_XSDFLAGS += --custom-allocator
+endif
+
library-pdriver: library-pdriver.o library-pskel.o library-pimpl.o $(root)/libxsde/xsde/libxsde.a
library-pdriver.o: library-pdriver.cxx library-pimpl.hxx library-pskel.hxx
diff --git a/dist/examples/cxx/parser/generated/nmakefile b/dist/examples/cxx/parser/generated/nmakefile
index c801757..e505207 100644
--- a/dist/examples/cxx/parser/generated/nmakefile
+++ b/dist/examples/cxx/parser/generated/nmakefile
@@ -46,6 +46,10 @@ EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --reuse-style-mixin
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --runtime-polymorphic
!endif
+!if "$(XSDE_CUSTOM_ALLOCATOR)" == "y"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --custom-allocator
+!endif
+
library-pdriver.exe: library-pdriver.obj library-pskel.obj library-pimpl.obj $(root)\libxsde\xsde\xsde.lib
library-pdriver.obj: library-pdriver.cxx library-pimpl.hxx library-pskel.hxx
diff --git a/dist/examples/cxx/parser/makefile b/dist/examples/cxx/parser/makefile
index c286089..e0d9974 100644
--- a/dist/examples/cxx/parser/makefile
+++ b/dist/examples/cxx/parser/makefile
@@ -4,6 +4,8 @@ include $(root)/build/config.make
dirs :=
+ifeq ($(XSDE_CUSTOM_ALLOCATOR),n)
+
ifneq ($(XSDE_REUSE_STYLE),none)
dirs += generated
endif
@@ -39,6 +41,15 @@ endif
endif
endif
+else # XSDE_CUSTOM_ALLOCATOR
+
+ifeq ($(XSDE_DEFAULT_ALLOCATOR),y)
+ifneq ($(XSDE_REUSE_STYLE),none)
+dirs += generated
+endif
+endif
+
+endif
.PHONY: all $(dirs)
diff --git a/dist/examples/cxx/parser/nmakefile b/dist/examples/cxx/parser/nmakefile
index 8e88704..a23503d 100644
--- a/dist/examples/cxx/parser/nmakefile
+++ b/dist/examples/cxx/parser/nmakefile
@@ -4,6 +4,8 @@ root = ..\..\..
dirs =
+!if "$(XSDE_CUSTOM_ALLOCATOR)" == "n"
+
!if "$(XSDE_REUSE_STYLE)" != "none"
dirs = $(dirs) generated
!endif
@@ -39,6 +41,16 @@ dirs = $(dirs) minimal
!endif
!endif
+!else # XSDE_CUSTOM_ALLOCATOR
+
+!if "$(XSDE_DEFAULT_ALLOCATOR)" == "y"
+!if "$(XSDE_REUSE_STYLE)" != "none"
+dirs = $(dirs) generated
+!endif
+!endif
+
+!endif
+
all:
@for %i in ( $(dirs) ) do \
@cmd /c "echo entering %i && cd %i && $(MAKE) /nologo /f nmakefile" || exit 1
diff --git a/dist/examples/cxx/serializer/makefile b/dist/examples/cxx/serializer/makefile
index 7677036..4164240 100644
--- a/dist/examples/cxx/serializer/makefile
+++ b/dist/examples/cxx/serializer/makefile
@@ -4,6 +4,8 @@ include $(root)/build/config.make
dirs :=
+ifeq ($(XSDE_CUSTOM_ALLOCATOR),n)
+
ifeq ($(XSDE_STL),y)
ifeq ($(XSDE_IOSTREAM),y)
ifeq ($(XSDE_EXCEPTIONS),y)
@@ -35,6 +37,7 @@ endif
endif
endif
+endif # XSDE_CUSTOM_ALLOCATOR
.PHONY: all $(dirs)
diff --git a/dist/examples/cxx/serializer/nmakefile b/dist/examples/cxx/serializer/nmakefile
index cd87db8..ee2224d 100644
--- a/dist/examples/cxx/serializer/nmakefile
+++ b/dist/examples/cxx/serializer/nmakefile
@@ -4,6 +4,8 @@ root = ..\..\..
dirs =
+!if "$(XSDE_CUSTOM_ALLOCATOR)" == "n"
+
!if "$(XSDE_STL)" == "y"
!if "$(XSDE_IOSTREAM)" == "y"
!if "$(XSDE_EXCEPTIONS)" == "y"
@@ -35,6 +37,8 @@ dirs = $(dirs) minimal
!endif
!endif
+!endif # XSDE_CUSTOM_ALLOCATOR
+
all:
@for %i in ( $(dirs) ) do \
@cmd /c "echo entering %i && cd %i && $(MAKE) /nologo /f nmakefile" || exit 1