From 0bce70a0e483294b83b8bf9d5468838a63405612 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov
Date: Sun, 8 Mar 2009 17:23:30 +0200
Subject: Add support for binary representations
xsde/cxx/hybrid/insertion-*: insertion operators generator
xsde/cxx/hybrid/extraction-*: extraction operators generator
libxsde/xsde/cxx/hybrid/cdr/: CDR support code
libxsde/xsde/cxx/hybrid/xdr/: XDR support code
tests/cxx/hybrid/binary/: new tests
examples/cxx/hybrid/binary/: new examples
documentation/cxx/hybrid/guide/: new chapter
---
NEWS | 15 +
build/configuration.make | 4 +
build/configure | 17 +
build/import/libace/LICENSE | 340 +++++++
build/import/libace/configuration-rules.make | 15 +
build/import/libace/configure | 58 ++
build/import/libace/rules.make | 29 +
build/import/libace/stub.make | 32 +
build/import/libace/version | 1 +
dist/build/config.make | 2 +
dist/config/config.make | 16 +
dist/config/config.nmake | 16 +
dist/etc/evc-4.0/config.nmake | 16 +
dist/etc/iphone/config-device.make | 16 +
dist/etc/iphone/config-simulator.make | 16 +
dist/etc/lynxos/config-4.2.make | 16 +
dist/etc/qnx/config-6.3-gcc-2.95.make | 16 +
dist/etc/qnx/config-6.3-gcc-3.3.make | 16 +
dist/etc/qnx/config-6.4.make | 16 +
dist/etc/vc-8.0/config-max.nmake | 16 +
dist/etc/vc-8.0/config-min.nmake | 16 +
dist/etc/vc-9.0/config-max.nmake | 16 +
dist/etc/vc-9.0/config-min.nmake | 16 +
dist/etc/vxworks/config-5.5.1.make | 16 +
dist/etc/vxworks/config-6.4-max.make | 168 ++++
dist/etc/vxworks/config-6.4-min.make | 156 ++++
dist/etc/vxworks/config-max-6.4.make | 152 ----
dist/etc/vxworks/config-min-6.4.make | 140 ---
dist/examples/cxx/hybrid/binary/cdr/makefile | 58 ++
dist/examples/cxx/hybrid/binary/cdr/nmakefile | 55 ++
dist/examples/cxx/hybrid/binary/custom/makefile | 70 ++
dist/examples/cxx/hybrid/binary/custom/nmakefile | 68 ++
dist/examples/cxx/hybrid/binary/custom/options | 8 +
dist/examples/cxx/hybrid/binary/makefile | 33 +
dist/examples/cxx/hybrid/binary/nmakefile | 29 +
dist/examples/cxx/hybrid/binary/xdr/makefile | 58 ++
dist/examples/cxx/hybrid/binary/xdr/nmakefile | 53 ++
dist/examples/cxx/hybrid/makefile | 2 +-
dist/libxsde/xsde/makefile | 19 +
dist/libxsde/xsde/nmakefile | 19 +
documentation/cxx/hybrid/guide/index.xhtml | 289 ++++++
documentation/xsde.1 | 28 +
documentation/xsde.xhtml | 22 +
examples/cxx/hybrid/README | 4 +
examples/cxx/hybrid/binary/README | 16 +
examples/cxx/hybrid/binary/cdr/README | 51 ++
examples/cxx/hybrid/binary/cdr/driver.cxx | 128 +++
examples/cxx/hybrid/binary/cdr/library.xml | 53 ++
examples/cxx/hybrid/binary/cdr/library.xsd | 69 ++
examples/cxx/hybrid/binary/cdr/makefile | 112 +++
examples/cxx/hybrid/binary/custom/README | 77 ++
examples/cxx/hybrid/binary/custom/driver.cxx | 107 +++
examples/cxx/hybrid/binary/custom/exceptions.cxx | 11 +
examples/cxx/hybrid/binary/custom/exceptions.hxx | 16 +
examples/cxx/hybrid/binary/custom/irawstream.cxx | 296 ++++++
examples/cxx/hybrid/binary/custom/irawstream.hxx | 92 ++
examples/cxx/hybrid/binary/custom/irawstream.ixx | 110 +++
examples/cxx/hybrid/binary/custom/irawstream.txx | 72 ++
examples/cxx/hybrid/binary/custom/library.xml | 53 ++
examples/cxx/hybrid/binary/custom/library.xsd | 69 ++
examples/cxx/hybrid/binary/custom/makefile | 138 +++
examples/cxx/hybrid/binary/custom/orawstream.cxx | 224 +++++
examples/cxx/hybrid/binary/custom/orawstream.hxx | 91 ++
examples/cxx/hybrid/binary/custom/orawstream.ixx | 110 +++
examples/cxx/hybrid/binary/custom/orawstream.txx | 47 +
examples/cxx/hybrid/binary/makefile | 53 ++
examples/cxx/hybrid/binary/xdr/README | 50 +
examples/cxx/hybrid/binary/xdr/driver.cxx | 196 ++++
examples/cxx/hybrid/binary/xdr/library.xml | 53 ++
examples/cxx/hybrid/binary/xdr/library.xsd | 69 ++
examples/cxx/hybrid/binary/xdr/makefile | 112 +++
examples/cxx/hybrid/makefile | 6 +-
libxsde/xsde/cxx/hybrid/cdr/date-time.cxx | 764 ++++++++++++++++
libxsde/xsde/cxx/hybrid/cdr/exceptions.cxx | 21 +
libxsde/xsde/cxx/hybrid/cdr/exceptions.hxx | 26 +
libxsde/xsde/cxx/hybrid/cdr/istream.cxx | 101 ++
libxsde/xsde/cxx/hybrid/cdr/istream.hxx | 182 ++++
libxsde/xsde/cxx/hybrid/cdr/istream.ixx | 385 ++++++++
libxsde/xsde/cxx/hybrid/cdr/istream.txx | 184 ++++
libxsde/xsde/cxx/hybrid/cdr/ostream.cxx | 88 ++
libxsde/xsde/cxx/hybrid/cdr/ostream.hxx | 182 ++++
libxsde/xsde/cxx/hybrid/cdr/ostream.ixx | 245 +++++
libxsde/xsde/cxx/hybrid/cdr/ostream.txx | 110 +++
libxsde/xsde/cxx/hybrid/cdr/qname.cxx | 74 ++
libxsde/xsde/cxx/hybrid/cdr/string-sequence.cxx | 107 +++
libxsde/xsde/cxx/hybrid/sequence.hxx | 2 +-
libxsde/xsde/cxx/hybrid/xdr/date-time.cxx | 764 ++++++++++++++++
libxsde/xsde/cxx/hybrid/xdr/exceptions.cxx | 21 +
libxsde/xsde/cxx/hybrid/xdr/exceptions.hxx | 26 +
libxsde/xsde/cxx/hybrid/xdr/istream.cxx | 135 +++
libxsde/xsde/cxx/hybrid/xdr/istream.hxx | 181 ++++
libxsde/xsde/cxx/hybrid/xdr/istream.ixx | 365 ++++++++
libxsde/xsde/cxx/hybrid/xdr/istream.txx | 184 ++++
libxsde/xsde/cxx/hybrid/xdr/ostream.cxx | 92 ++
libxsde/xsde/cxx/hybrid/xdr/ostream.hxx | 181 ++++
libxsde/xsde/cxx/hybrid/xdr/ostream.ixx | 281 ++++++
libxsde/xsde/cxx/hybrid/xdr/ostream.txx | 110 +++
libxsde/xsde/cxx/hybrid/xdr/qname.cxx | 74 ++
libxsde/xsde/cxx/hybrid/xdr/string-sequence.cxx | 107 +++
libxsde/xsde/cxx/sequence-base.hxx | 2 +-
libxsde/xsde/makefile | 34 +-
tests/cxx/hybrid/binary/cdr/driver.cxx | 102 +++
tests/cxx/hybrid/binary/cdr/makefile | 97 ++
tests/cxx/hybrid/binary/cdr/output.xml | 2 +
tests/cxx/hybrid/binary/cdr/test.xml | 93 ++
tests/cxx/hybrid/binary/cdr/test.xsd | 131 +++
tests/cxx/hybrid/binary/custom/driver.cxx | 102 +++
tests/cxx/hybrid/binary/custom/makefile | 128 +++
tests/cxx/hybrid/binary/custom/output.xml | 2 +
tests/cxx/hybrid/binary/custom/test.xml | 93 ++
tests/cxx/hybrid/binary/custom/test.xsd | 131 +++
tests/cxx/hybrid/binary/xdr/driver.cxx | 147 +++
tests/cxx/hybrid/binary/xdr/makefile | 98 ++
tests/cxx/hybrid/binary/xdr/output.xml | 2 +
tests/cxx/hybrid/binary/xdr/test.xml | 93 ++
tests/cxx/hybrid/binary/xdr/test.xsd | 131 +++
tests/cxx/hybrid/makefile | 8 +
xsde/cxx/hybrid/cli.hxx | 4 +
xsde/cxx/hybrid/elements.cxx | 42 +-
xsde/cxx/hybrid/elements.hxx | 37 +-
xsde/cxx/hybrid/extraction-header.cxx | 255 ++++++
xsde/cxx/hybrid/extraction-header.hxx | 22 +
xsde/cxx/hybrid/extraction-source.cxx | 1063 ++++++++++++++++++++++
xsde/cxx/hybrid/extraction-source.hxx | 22 +
xsde/cxx/hybrid/generator.cxx | 30 +-
xsde/cxx/hybrid/insertion-header.cxx | 255 ++++++
xsde/cxx/hybrid/insertion-header.hxx | 22 +
xsde/cxx/hybrid/insertion-source.cxx | 694 ++++++++++++++
xsde/cxx/hybrid/insertion-source.hxx | 22 +
xsde/cxx/hybrid/tree-forward.cxx | 87 ++
xsde/cxx/hybrid/tree-header.cxx | 3 -
xsde/makefile | 4 +
132 files changed, 13293 insertions(+), 306 deletions(-)
create mode 100644 build/import/libace/LICENSE
create mode 100644 build/import/libace/configuration-rules.make
create mode 100755 build/import/libace/configure
create mode 100644 build/import/libace/rules.make
create mode 100644 build/import/libace/stub.make
create mode 100644 build/import/libace/version
create mode 100644 dist/etc/vxworks/config-6.4-max.make
create mode 100644 dist/etc/vxworks/config-6.4-min.make
delete mode 100644 dist/etc/vxworks/config-max-6.4.make
delete mode 100644 dist/etc/vxworks/config-min-6.4.make
create mode 100644 dist/examples/cxx/hybrid/binary/cdr/makefile
create mode 100644 dist/examples/cxx/hybrid/binary/cdr/nmakefile
create mode 100644 dist/examples/cxx/hybrid/binary/custom/makefile
create mode 100644 dist/examples/cxx/hybrid/binary/custom/nmakefile
create mode 100644 dist/examples/cxx/hybrid/binary/custom/options
create mode 100644 dist/examples/cxx/hybrid/binary/makefile
create mode 100644 dist/examples/cxx/hybrid/binary/nmakefile
create mode 100644 dist/examples/cxx/hybrid/binary/xdr/makefile
create mode 100644 dist/examples/cxx/hybrid/binary/xdr/nmakefile
create mode 100644 examples/cxx/hybrid/binary/README
create mode 100644 examples/cxx/hybrid/binary/cdr/README
create mode 100644 examples/cxx/hybrid/binary/cdr/driver.cxx
create mode 100644 examples/cxx/hybrid/binary/cdr/library.xml
create mode 100644 examples/cxx/hybrid/binary/cdr/library.xsd
create mode 100644 examples/cxx/hybrid/binary/cdr/makefile
create mode 100644 examples/cxx/hybrid/binary/custom/README
create mode 100644 examples/cxx/hybrid/binary/custom/driver.cxx
create mode 100644 examples/cxx/hybrid/binary/custom/exceptions.cxx
create mode 100644 examples/cxx/hybrid/binary/custom/exceptions.hxx
create mode 100644 examples/cxx/hybrid/binary/custom/irawstream.cxx
create mode 100644 examples/cxx/hybrid/binary/custom/irawstream.hxx
create mode 100644 examples/cxx/hybrid/binary/custom/irawstream.ixx
create mode 100644 examples/cxx/hybrid/binary/custom/irawstream.txx
create mode 100644 examples/cxx/hybrid/binary/custom/library.xml
create mode 100644 examples/cxx/hybrid/binary/custom/library.xsd
create mode 100644 examples/cxx/hybrid/binary/custom/makefile
create mode 100644 examples/cxx/hybrid/binary/custom/orawstream.cxx
create mode 100644 examples/cxx/hybrid/binary/custom/orawstream.hxx
create mode 100644 examples/cxx/hybrid/binary/custom/orawstream.ixx
create mode 100644 examples/cxx/hybrid/binary/custom/orawstream.txx
create mode 100644 examples/cxx/hybrid/binary/makefile
create mode 100644 examples/cxx/hybrid/binary/xdr/README
create mode 100644 examples/cxx/hybrid/binary/xdr/driver.cxx
create mode 100644 examples/cxx/hybrid/binary/xdr/library.xml
create mode 100644 examples/cxx/hybrid/binary/xdr/library.xsd
create mode 100644 examples/cxx/hybrid/binary/xdr/makefile
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/date-time.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/exceptions.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/exceptions.hxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/istream.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/istream.hxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/istream.ixx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/istream.txx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/ostream.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/ostream.hxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/ostream.ixx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/ostream.txx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/qname.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/cdr/string-sequence.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/date-time.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/exceptions.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/exceptions.hxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/istream.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/istream.hxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/istream.ixx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/istream.txx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/ostream.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/ostream.hxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/ostream.ixx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/ostream.txx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/qname.cxx
create mode 100644 libxsde/xsde/cxx/hybrid/xdr/string-sequence.cxx
create mode 100644 tests/cxx/hybrid/binary/cdr/driver.cxx
create mode 100644 tests/cxx/hybrid/binary/cdr/makefile
create mode 100644 tests/cxx/hybrid/binary/cdr/output.xml
create mode 100644 tests/cxx/hybrid/binary/cdr/test.xml
create mode 100644 tests/cxx/hybrid/binary/cdr/test.xsd
create mode 100644 tests/cxx/hybrid/binary/custom/driver.cxx
create mode 100644 tests/cxx/hybrid/binary/custom/makefile
create mode 100644 tests/cxx/hybrid/binary/custom/output.xml
create mode 100644 tests/cxx/hybrid/binary/custom/test.xml
create mode 100644 tests/cxx/hybrid/binary/custom/test.xsd
create mode 100644 tests/cxx/hybrid/binary/xdr/driver.cxx
create mode 100644 tests/cxx/hybrid/binary/xdr/makefile
create mode 100644 tests/cxx/hybrid/binary/xdr/output.xml
create mode 100644 tests/cxx/hybrid/binary/xdr/test.xml
create mode 100644 tests/cxx/hybrid/binary/xdr/test.xsd
create mode 100644 xsde/cxx/hybrid/extraction-header.cxx
create mode 100644 xsde/cxx/hybrid/extraction-header.hxx
create mode 100644 xsde/cxx/hybrid/extraction-source.cxx
create mode 100644 xsde/cxx/hybrid/extraction-source.hxx
create mode 100644 xsde/cxx/hybrid/insertion-header.cxx
create mode 100644 xsde/cxx/hybrid/insertion-header.hxx
create mode 100644 xsde/cxx/hybrid/insertion-source.cxx
create mode 100644 xsde/cxx/hybrid/insertion-source.hxx
diff --git a/NEWS b/NEWS
index cb3d35b..73398df 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,18 @@
+Version 3.1.0
+
+ C++/Hybrid
+
+ * Support for saving the object model to and loading it from binary
+ representations. The new --generate--insertion and --generate-extraction
+ options trigger generation of data representation stream insertion and
+ extraction operators, respectively. The XSD/e runtime provides support
+ for the ACE CDR streams and XDR API that is part of Sun RPC. Custom
+ representations can supported by implementing insertion and extraction
+ operators for the built-in XML Schema types and sequence templates. For
+ more information, see Chapter 7, "Binary Representation" in the Getting
+ Started Guide as well as examples in the examples/cxx/hybrid/binary/
+ directory.
+
Version 3.0.0
* The new Embedded C++/Hybrid mapping provides a light-weight, tree-
diff --git a/build/configuration.make b/build/configuration.make
index 6efbbfd..bb7b932 100644
--- a/build/configuration.make
+++ b/build/configuration.make
@@ -18,6 +18,8 @@ xsde_snprintf :=
xsde_parser_validation :=
xsde_serializer_validation :=
xsde_reuse_style :=
+xsde_xdr :=
+xsde_cdr :=
xsde_polymorphic :=
xsde_parser_smap_buckets :=
xsde_parser_imap_buckets :=
@@ -40,6 +42,8 @@ $(out_root)/%: xsde_snprintf := $(xsde_snprintf)
$(out_root)/%: xsde_parser_validation := $(xsde_parser_validation)
$(out_root)/%: xsde_serializer_validation := $(xsde_serializer_validation)
$(out_root)/%: xsde_reuse_style := $(xsde_reuse_style)
+$(out_root)/%: xsde_xdr := $(xsde_xdr)
+$(out_root)/%: xsde_cdr := $(xsde_cdr)
$(out_root)/%: xsde_polymorphic := $(xsde_polymorphic)
$(out_root)/%: xsde_parser_smap_buckets := $(xsde_parser_smap_buckets)
$(out_root)/%: xsde_parser_imap_buckets := $(xsde_parser_imap_buckets)
diff --git a/build/configure b/build/configure
index d99f1c2..16bccff 100755
--- a/build/configure
+++ b/build/configure
@@ -92,6 +92,21 @@ $echo
reuse_style=`read_option "mixin tiein none" "tiein"`
$echo
+$echo "Would you like to build support for serialization in XDR format?"
+$echo "This requires the XDR API that is part of Sun RPC (rpc/xdr.h)."
+$echo
+
+xdr=`read_y_n n`
+
+$echo
+$echo "Would you like to build support for serialization in CDR format?"
+$echo "This requires the ACE library."
+$echo
+
+cdr=`read_y_n n`
+
+
+$echo
$echo "Would you like the runtime library to support XML Schema polymorphism"
$echo "(xsi:type and substitution groups)?"
$echo
@@ -152,6 +167,8 @@ echo "xsde_snprintf := $snprintf" >>
echo "xsde_parser_validation := $parser_validation" >>$1
echo "xsde_serializer_validation := $serializer_validation" >>$1
echo "xsde_reuse_style := $reuse_style" >>$1
+echo "xsde_xdr := $xdr" >>$1
+echo "xsde_cdr := $cdr" >>$1
echo "xsde_polymorphic := $polymorphic" >>$1
echo "xsde_parser_smap_buckets := $parser_smap_buckets" >>$1
echo "xsde_parser_imap_buckets := $parser_imap_buckets" >>$1
diff --git a/build/import/libace/LICENSE b/build/import/libace/LICENSE
new file mode 100644
index 0000000..3912109
--- /dev/null
+++ b/build/import/libace/LICENSE
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/build/import/libace/configuration-rules.make b/build/import/libace/configuration-rules.make
new file mode 100644
index 0000000..0c262e6
--- /dev/null
+++ b/build/import/libace/configuration-rules.make
@@ -0,0 +1,15 @@
+# file : build/import/libace/configuration-rules.make
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2005-2008 Boris Kolpackov
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(dcf_root)/import/libace/configuration-dynamic.make: | $(dcf_root)/import/libace/.
+ $(call message,,$(scf_root)/import/libace/configure $@)
+
+ifndef %foreign%
+
+disfigure::
+ $(call message,rm $(dcf_root)/import/libace/configuration-dynamic.make,\
+rm -f $(dcf_root)/import/libace/configuration-dynamic.make)
+
+endif
diff --git a/build/import/libace/configure b/build/import/libace/configure
new file mode 100755
index 0000000..2f9f276
--- /dev/null
+++ b/build/import/libace/configure
@@ -0,0 +1,58 @@
+#! /usr/bin/env bash
+
+# file : build/import/libace/configure
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2005-2008 Boris Kolpackov
+# license : GNU GPL v2; see accompanying LICENSE file
+
+
+# $1 - out config file
+#
+# bld_root - build root
+# project_name - project name
+#
+
+source $bld_root/dialog.bash
+
+
+$echo
+$echo "Configuring external dependency on 'ACE' for '$project_name'."
+$echo
+
+$echo
+$echo "Would you like to configure dependency on the installed version"
+$echo "of 'ACE' as opposed to the development build?"
+$echo
+
+installed=`read_y_n y`
+
+path=
+type=
+
+if [ "$installed" = "n" ]; then
+
+ $echo
+ $echo "Please enter the 'ACE' root directory (ACE_ROOT)."
+ $echo
+
+ root=`read_path --directory --exist`
+
+ $echo
+ $echo "Please select the library type you would like to use:"
+ $echo
+ $echo "(1) archive"
+ $echo "(2) shared object"
+ $echo
+
+ type=`read_option "archive shared" "shared"`
+
+fi
+
+echo libace_installed := $installed >$1
+
+if [ "$installed" = "n" ]; then
+
+ echo libace_root := $root >>$1
+ echo libace_type := $type >>$1
+
+fi
diff --git a/build/import/libace/rules.make b/build/import/libace/rules.make
new file mode 100644
index 0000000..1a4cfaa
--- /dev/null
+++ b/build/import/libace/rules.make
@@ -0,0 +1,29 @@
+# file : build/import/libace/rules.make
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2005-2008 Boris Kolpackov
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(dcf_root)/import/libace/%: root := $(libace_root)
+
+ifeq ($(libace_type),archive)
+
+$(dcf_root)/import/libace/ace.l: $(libace_root)/lib/libACE.a
+ @echo $< >$@
+else
+
+$(dcf_root)/import/libace/ace.l: $(libace_root)/lib/libACE.so
+ @echo $< >$@
+ @echo rpath:$(root)/lib >>$@
+endif
+
+$(dcf_root)/import/libace/ace.l.cpp-options:
+ @echo include: -I$(root) >$@
+
+ifndef %foreign%
+
+disfigure::
+ $(call message,rm $(dcf_root)/import/libace/ace.l,\
+rm -f $(dcf_root)/import/libace/ace.l)
+ $(call message,,rm -f $(dcf_root)/import/libace/ace.l.cpp-options)
+
+endif
diff --git a/build/import/libace/stub.make b/build/import/libace/stub.make
new file mode 100644
index 0000000..a1274b0
--- /dev/null
+++ b/build/import/libace/stub.make
@@ -0,0 +1,32 @@
+# file : build/import/libace/stub.make
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2005-2008 Boris Kolpackov
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(call include-once,$(scf_root)/import/libace/configuration-rules.make,$(dcf_root))
+
+libace_installed :=
+
+$(call -include,$(dcf_root)/import/libace/configuration-dynamic.make)
+
+ifdef libace_installed
+
+ifeq ($(libace_installed),y)
+
+$(call export,l: -lACE,cpp-options: )
+
+else
+
+$(call include-once,$(scf_root)/import/libace/rules.make,$(dcf_root))
+
+$(call export,\
+ l: $(dcf_root)/import/libace/ace.l,\
+ cpp-options: $(dcf_root)/import/libace/ace.l.cpp-options)
+
+endif
+
+else
+
+.NOTPARALLEL:
+
+endif
diff --git a/build/import/libace/version b/build/import/libace/version
new file mode 100644
index 0000000..0d91a54
--- /dev/null
+++ b/build/import/libace/version
@@ -0,0 +1 @@
+0.3.0
diff --git a/dist/build/config.make b/dist/build/config.make
index 44f3c36..532bdf0 100644
--- a/dist/build/config.make
+++ b/dist/build/config.make
@@ -22,6 +22,8 @@ XSDE_SNPRINTF := $(strip $(XSDE_SNPRINTF))
XSDE_PARSER_VALIDATION := $(strip $(XSDE_PARSER_VALIDATION))
XSDE_SERIALIZER_VALIDATION := $(strip $(XSDE_SERIALIZER_VALIDATION))
XSDE_REUSE_STYLE := $(strip $(XSDE_REUSE_STYLE))
+XSDE_CDR := $(strip $(XSDE_CDR))
+XSDE_XDR := $(strip $(XSDE_XDR))
XSDE_POLYMORPHIC := $(strip $(XSDE_POLYMORPHIC))
XSDE_PARSER_SMAP_BUCKETS := $(strip $(XSDE_PARSER_SMAP_BUCKETS))
XSDE_PARSER_IMAP_BUCKETS := $(strip $(XSDE_PARSER_IMAP_BUCKETS))
diff --git a/dist/config/config.make b/dist/config/config.make
index b6c4212..0602490 100644
--- a/dist/config/config.make
+++ b/dist/config/config.make
@@ -95,6 +95,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/config/config.nmake b/dist/config/config.nmake
index 6279c60..79e68d8 100644
--- a/dist/config/config.nmake
+++ b/dist/config/config.nmake
@@ -94,6 +94,22 @@ XSDE_SERIALIZER_VALIDATION = y
XSDE_REUSE_STYLE = tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR = n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR = n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/evc-4.0/config.nmake b/dist/etc/evc-4.0/config.nmake
index 78d5840..b42a80b 100644
--- a/dist/etc/evc-4.0/config.nmake
+++ b/dist/etc/evc-4.0/config.nmake
@@ -97,6 +97,22 @@ XSDE_SERIALIZER_VALIDATION = y
XSDE_REUSE_STYLE = tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR = n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR = n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/iphone/config-device.make b/dist/etc/iphone/config-device.make
index 84fd828..8fde555 100644
--- a/dist/etc/iphone/config-device.make
+++ b/dist/etc/iphone/config-device.make
@@ -102,6 +102,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/iphone/config-simulator.make b/dist/etc/iphone/config-simulator.make
index fc9ab84..0f2853d 100644
--- a/dist/etc/iphone/config-simulator.make
+++ b/dist/etc/iphone/config-simulator.make
@@ -102,6 +102,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/lynxos/config-4.2.make b/dist/etc/lynxos/config-4.2.make
index 56ff0e1..183566d 100644
--- a/dist/etc/lynxos/config-4.2.make
+++ b/dist/etc/lynxos/config-4.2.make
@@ -101,6 +101,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/qnx/config-6.3-gcc-2.95.make b/dist/etc/qnx/config-6.3-gcc-2.95.make
index 0b4b28d..fe97e86 100644
--- a/dist/etc/qnx/config-6.3-gcc-2.95.make
+++ b/dist/etc/qnx/config-6.3-gcc-2.95.make
@@ -100,6 +100,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/qnx/config-6.3-gcc-3.3.make b/dist/etc/qnx/config-6.3-gcc-3.3.make
index 80343c4..37345f6 100644
--- a/dist/etc/qnx/config-6.3-gcc-3.3.make
+++ b/dist/etc/qnx/config-6.3-gcc-3.3.make
@@ -100,6 +100,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/qnx/config-6.4.make b/dist/etc/qnx/config-6.4.make
index d14e458..3d4f3b6 100644
--- a/dist/etc/qnx/config-6.4.make
+++ b/dist/etc/qnx/config-6.4.make
@@ -100,6 +100,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/vc-8.0/config-max.nmake b/dist/etc/vc-8.0/config-max.nmake
index cd1e4a1..1fb78e5 100644
--- a/dist/etc/vc-8.0/config-max.nmake
+++ b/dist/etc/vc-8.0/config-max.nmake
@@ -98,6 +98,22 @@ XSDE_SERIALIZER_VALIDATION = y
XSDE_REUSE_STYLE = tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR = n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR = n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/vc-8.0/config-min.nmake b/dist/etc/vc-8.0/config-min.nmake
index b2f3c6d..2d4f742 100644
--- a/dist/etc/vc-8.0/config-min.nmake
+++ b/dist/etc/vc-8.0/config-min.nmake
@@ -98,6 +98,22 @@ XSDE_SERIALIZER_VALIDATION = y
XSDE_REUSE_STYLE = tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR = n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR = n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/vc-9.0/config-max.nmake b/dist/etc/vc-9.0/config-max.nmake
index 24bf39b..585ff0e 100644
--- a/dist/etc/vc-9.0/config-max.nmake
+++ b/dist/etc/vc-9.0/config-max.nmake
@@ -98,6 +98,22 @@ XSDE_SERIALIZER_VALIDATION = y
XSDE_REUSE_STYLE = tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR = n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR = n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/vc-9.0/config-min.nmake b/dist/etc/vc-9.0/config-min.nmake
index c085f97..1b141df 100644
--- a/dist/etc/vc-9.0/config-min.nmake
+++ b/dist/etc/vc-9.0/config-min.nmake
@@ -98,6 +98,22 @@ XSDE_SERIALIZER_VALIDATION = y
XSDE_REUSE_STYLE = tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR = n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR = n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/vxworks/config-5.5.1.make b/dist/etc/vxworks/config-5.5.1.make
index 2de4676..65d96ad 100644
--- a/dist/etc/vxworks/config-5.5.1.make
+++ b/dist/etc/vxworks/config-5.5.1.make
@@ -101,6 +101,22 @@ XSDE_SERIALIZER_VALIDATION := y
XSDE_REUSE_STYLE := tiein
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
# Set to 'y' if you need to handle XML vocabularies that use XML Schema
# polymorphism (xsi:type or substitution groups). Also don't forget to
# use either --generate-polymorphic (generates polymorphism-aware code)
diff --git a/dist/etc/vxworks/config-6.4-max.make b/dist/etc/vxworks/config-6.4-max.make
new file mode 100644
index 0000000..ac063e4
--- /dev/null
+++ b/dist/etc/vxworks/config-6.4-max.make
@@ -0,0 +1,168 @@
+# Sample configuration file for VxWorks 6.4 on Pentium using the
+# GNU toolchain. This configuration enables STL, iostream, and
+# C++ exceptions which can be disabled if not required.
+#
+# Note that iostream support requires static initialization so
+# you will need to 'munch' the examples (and your application)
+# before you can run them. Here are the sample step that are
+# needed to run the C++/Hybrid 'library' example:
+#
+# $ cd examples/cxx/hybrid/library/
+# $ make
+# $ mv driver partial-image.o
+# $ nmpentium *.o | tclsh .../vxworks-6.4/host/resource/hutils/tcl/munch.tcl -c pentium > ctdt.c
+# $ ccpentium -O3 -c -fdollars-in-identifiers -fno-zero-initialized-in-bss ctdt.c -o ctdt.o
+# $ ccpentium -O3 partial-image.o ctdt.o -o driver
+#
+
+# Toolchain.
+#
+CC := ccpentium
+CFLAGS := -W -Wall -O3
+CPPFLAGS :=
+
+CXX := ccpentium
+CXXFLAGS := -W -Wall -O3
+
+LD := $(CXX)
+LDFLAGS := $(CXXFLAGS)
+LIBS :=
+
+# Set RANLIB to empty if your system does not need ranlib.
+#
+AR := arpentium
+ARFLAGS := rc
+RANLIB := ranlibpentium
+
+
+# Common XSD/e flags.
+#
+XSDFLAGS := --generate-inline
+
+
+# Platform. Valid values are:
+#
+# 'wince' - Windows CE
+# 'win32' - Windows 2000, XP, etc.
+# 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc.
+#
+XSDE_PLATFORM := posix
+
+
+# Platform architecture width in bits.
+#
+XSDE_ARCH_WIDTH := 32
+
+
+# Platform byte order. Valid values are 'b' for big-endian
+# and 'l' for little-endian.
+#
+XSDE_BYTEORDER := l
+
+
+# Set to 'n' if you don't have STL (std::string, etc.). Also don't
+# forget to use the --no-stl option when compiling your schemas.
+#
+XSDE_STL := y
+
+
+# Set to 'n' if you don't have iostream.
+#
+XSDE_IOSTREAM := y
+
+
+# Set to 'n' if you don't have C++ exceptions. Also don't forget to
+# use the --no-exceptions option when compiling your schemas.
+#
+XSDE_EXCEPTIONS := y
+
+
+# Set to 'n' if your platform doesn't have the "long long int" type or
+# the strtoull function. Also don't forget to use the --no-long-long
+# option when compiling your schemas.
+#
+XSDE_LONGLONG := n
+
+
+# Set to 'n' if your platform doesn't have the snprintf function.
+#
+XSDE_SNPRINTF := n
+
+
+# Set to 'n' if you don't want support for XML Schema validation in
+# C++/Parser. Also don't forget to use the --suppress-validation
+# option when compiling your schemas.
+#
+XSDE_PARSER_VALIDATION := y
+
+
+# Set to 'n' if you don't want support for XML Schema validation in
+# C++/Serializer. Also don't forget to use the --suppress-validation
+# option when compiling your schemas.
+#
+XSDE_SERIALIZER_VALIDATION := y
+
+
+# Base parser/serializer implementation reuse style. Valid values are:
+#
+# 'mixin' - virtual inheritance-based reuse (specify --reuse-style-mixin)
+# 'tiein' - delegation-based reuse (recommended)
+# 'none' - no reuse support (specify --reuse-style-none)
+#
+XSDE_REUSE_STYLE := tiein
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
+# Set to 'y' if you need to handle XML vocabularies that use XML Schema
+# polymorphism (xsi:type or substitution groups). Also don't forget to
+# use either --generate-polymorphic (generates polymorphism-aware code)
+# or --runtime-polymorphic (generates non-polymorphic code that uses the
+# runtime library configured with polymorphism support). Note that support
+# for XML Schema polymorphism requires runtime static initialization
+# support in the C++ compiler (that is, support for automatic calling
+# of constructors for static objects). Furthermore, if the mixin reuse
+# style is used (XSDE_REUSE_STYLE) then the generated code requires
+# support for dynamic_cast.
+#
+XSDE_POLYMORPHIC := n
+
+
+# When polymorphism support is enabled (XSDE_POLYMORPHIC), the following
+# parameters control the substitution and inheritance hashmaps bucket
+# allocation. Because the number of elements in these hashmaps depends
+# on the schemas being compiled and thus is fairly static, these hashmaps
+# do not perform automatic table resizing. To obtain good performance the
+# elements to buckets ratio should be between 0.7 and 0.9. The recommended
+# way to ensure this range is to add diagnostics code to your application
+# as shown in the documentation and examples. It is also a good idea to
+# use prime numbers for bucket counts: 53 97 193 389 769 1543 3079 6151
+# 12289 24593 49157 98317 196613 393241. Inheritance hashmaps are only
+# used when validation is enabled.
+#
+XSDE_PARSER_SMAP_BUCKETS := 53
+XSDE_PARSER_IMAP_BUCKETS := 97
+XSDE_SERIALIZER_SMAP_BUCKETS := 53
+XSDE_SERIALIZER_SMAP_BUCKET_BUCKETS := 53
+XSDE_SERIALIZER_IMAP_BUCKETS := 97
+
+
+# Options tuning depending on the features selected.
+#
+ifeq ($(XSDE_EXCEPTIONS),y)
+CFLAGS += -fexceptions
+endif
diff --git a/dist/etc/vxworks/config-6.4-min.make b/dist/etc/vxworks/config-6.4-min.make
new file mode 100644
index 0000000..a9f9ba5
--- /dev/null
+++ b/dist/etc/vxworks/config-6.4-min.make
@@ -0,0 +1,156 @@
+# Sample configuration file for VxWorks 6.4 on Pentium using the
+# GNU toolchain. This configuration disables STL, iostream, and
+# C++ exceptions which can be enabled if required.
+#
+
+# Toolchain.
+#
+CC := ccpentium
+CFLAGS := -W -Wall -O3
+CPPFLAGS :=
+
+CXX := ccpentium
+CXXFLAGS := -W -Wall -O3
+
+LD := $(CXX)
+LDFLAGS := $(CXXFLAGS)
+LIBS :=
+
+# Set RANLIB to empty if your system does not need ranlib.
+#
+AR := arpentium
+ARFLAGS := rc
+RANLIB := ranlibpentium
+
+
+# Common XSD/e flags.
+#
+XSDFLAGS := --generate-inline
+
+
+# Platform. Valid values are:
+#
+# 'wince' - Windows CE
+# 'win32' - Windows 2000, XP, etc.
+# 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc.
+#
+XSDE_PLATFORM := posix
+
+
+# Platform architecture width in bits.
+#
+XSDE_ARCH_WIDTH := 32
+
+
+# Platform byte order. Valid values are 'b' for big-endian
+# and 'l' for little-endian.
+#
+XSDE_BYTEORDER := l
+
+
+# Set to 'n' if you don't have STL (std::string, etc.). Also don't
+# forget to use the --no-stl option when compiling your schemas.
+#
+XSDE_STL := n
+
+
+# Set to 'n' if you don't have iostream.
+#
+XSDE_IOSTREAM := n
+
+
+# Set to 'n' if you don't have C++ exceptions. Also don't forget to
+# use the --no-exceptions option when compiling your schemas.
+#
+XSDE_EXCEPTIONS := n
+
+
+# Set to 'n' if your platform doesn't have the "long long int" type or
+# the strtoull function. Also don't forget to use the --no-long-long
+# option when compiling your schemas.
+#
+XSDE_LONGLONG := n
+
+
+# Set to 'n' if your platform doesn't have the snprintf function.
+#
+XSDE_SNPRINTF := n
+
+
+# Set to 'n' if you don't want support for XML Schema validation in
+# C++/Parser. Also don't forget to use the --suppress-validation
+# option when compiling your schemas.
+#
+XSDE_PARSER_VALIDATION := y
+
+
+# Set to 'n' if you don't want support for XML Schema validation in
+# C++/Serializer. Also don't forget to use the --suppress-validation
+# option when compiling your schemas.
+#
+XSDE_SERIALIZER_VALIDATION := y
+
+
+# Base parser/serializer implementation reuse style. Valid values are:
+#
+# 'mixin' - virtual inheritance-based reuse (specify --reuse-style-mixin)
+# 'tiein' - delegation-based reuse (recommended)
+# 'none' - no reuse support (specify --reuse-style-none)
+#
+XSDE_REUSE_STYLE := tiein
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the CDR (Common Data Representation) binary format.
+# This functionality requires the ACE library.
+#
+XSDE_CDR := n
+
+
+# Set to 'y' if you want support for serialization of the C++/Hybrid
+# object model to the XDR (eXternal Data Representation) binary format.
+# This functionality requires the XDR API which is available out of the
+# box on most POSIX systems as part of Sun RPC. On other platforms you
+# may need to install a third-party library which provides the XDR API.
+#
+XSDE_XDR := n
+
+
+# Set to 'y' if you need to handle XML vocabularies that use XML Schema
+# polymorphism (xsi:type or substitution groups). Also don't forget to
+# use either --generate-polymorphic (generates polymorphism-aware code)
+# or --runtime-polymorphic (generates non-polymorphic code that uses the
+# runtime library configured with polymorphism support). Note that support
+# for XML Schema polymorphism requires runtime static initialization
+# support in the C++ compiler (that is, support for automatic calling
+# of constructors for static objects). Furthermore, if the mixin reuse
+# style is used (XSDE_REUSE_STYLE) then the generated code requires
+# support for dynamic_cast.
+#
+XSDE_POLYMORPHIC := n
+
+
+# When polymorphism support is enabled (XSDE_POLYMORPHIC), the following
+# parameters control the substitution and inheritance hashmaps bucket
+# allocation. Because the number of elements in these hashmaps depends
+# on the schemas being compiled and thus is fairly static, these hashmaps
+# do not perform automatic table resizing. To obtain good performance the
+# elements to buckets ratio should be between 0.7 and 0.9. The recommended
+# way to ensure this range is to add diagnostics code to your application
+# as shown in the documentation and examples. It is also a good idea to
+# use prime numbers for bucket counts: 53 97 193 389 769 1543 3079 6151
+# 12289 24593 49157 98317 196613 393241. Inheritance hashmaps are only
+# used when validation is enabled.
+#
+XSDE_PARSER_SMAP_BUCKETS := 53
+XSDE_PARSER_IMAP_BUCKETS := 97
+XSDE_SERIALIZER_SMAP_BUCKETS := 53
+XSDE_SERIALIZER_SMAP_BUCKET_BUCKETS := 53
+XSDE_SERIALIZER_IMAP_BUCKETS := 97
+
+
+# Options tuning depending on the features selected.
+#
+ifeq ($(XSDE_EXCEPTIONS),y)
+CFLAGS += -fexceptions
+endif
diff --git a/dist/etc/vxworks/config-max-6.4.make b/dist/etc/vxworks/config-max-6.4.make
deleted file mode 100644
index 5aa80e8..0000000
--- a/dist/etc/vxworks/config-max-6.4.make
+++ /dev/null
@@ -1,152 +0,0 @@
-# Sample configuration file for VxWorks 6.4 on Pentium using the
-# GNU toolchain. This configuration enables STL, iostream, and
-# C++ exceptions which can be disabled if not required.
-#
-# Note that iostream support requires static initialization so
-# you will need to 'munch' the examples (and your application)
-# before you can run them. Here are the sample step that are
-# needed to run the C++/Hybrid 'library' example:
-#
-# $ cd examples/cxx/hybrid/library/
-# $ make
-# $ mv driver partial-image.o
-# $ nmpentium *.o | tclsh .../vxworks-6.4/host/resource/hutils/tcl/munch.tcl -c pentium > ctdt.c
-# $ ccpentium -O3 -c -fdollars-in-identifiers -fno-zero-initialized-in-bss ctdt.c -o ctdt.o
-# $ ccpentium -O3 partial-image.o ctdt.o -o driver
-#
-
-# Toolchain.
-#
-CC := ccpentium
-CFLAGS := -W -Wall -O3
-CPPFLAGS :=
-
-CXX := ccpentium
-CXXFLAGS := -W -Wall -O3
-
-LD := $(CXX)
-LDFLAGS := $(CXXFLAGS)
-LIBS :=
-
-# Set RANLIB to empty if your system does not need ranlib.
-#
-AR := arpentium
-ARFLAGS := rc
-RANLIB := ranlibpentium
-
-
-# Common XSD/e flags.
-#
-XSDFLAGS := --generate-inline
-
-
-# Platform. Valid values are:
-#
-# 'wince' - Windows CE
-# 'win32' - Windows 2000, XP, etc.
-# 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc.
-#
-XSDE_PLATFORM := posix
-
-
-# Platform architecture width in bits.
-#
-XSDE_ARCH_WIDTH := 32
-
-
-# Platform byte order. Valid values are 'b' for big-endian
-# and 'l' for little-endian.
-#
-XSDE_BYTEORDER := l
-
-
-# Set to 'n' if you don't have STL (std::string, etc.). Also don't
-# forget to use the --no-stl option when compiling your schemas.
-#
-XSDE_STL := y
-
-
-# Set to 'n' if you don't have iostream.
-#
-XSDE_IOSTREAM := y
-
-
-# Set to 'n' if you don't have C++ exceptions. Also don't forget to
-# use the --no-exceptions option when compiling your schemas.
-#
-XSDE_EXCEPTIONS := y
-
-
-# Set to 'n' if your platform doesn't have the "long long int" type or
-# the strtoull function. Also don't forget to use the --no-long-long
-# option when compiling your schemas.
-#
-XSDE_LONGLONG := n
-
-
-# Set to 'n' if your platform doesn't have the snprintf function.
-#
-XSDE_SNPRINTF := n
-
-
-# Set to 'n' if you don't want support for XML Schema validation in
-# C++/Parser. Also don't forget to use the --suppress-validation
-# option when compiling your schemas.
-#
-XSDE_PARSER_VALIDATION := y
-
-
-# Set to 'n' if you don't want support for XML Schema validation in
-# C++/Serializer. Also don't forget to use the --suppress-validation
-# option when compiling your schemas.
-#
-XSDE_SERIALIZER_VALIDATION := y
-
-
-# Base parser/serializer implementation reuse style. Valid values are:
-#
-# 'mixin' - virtual inheritance-based reuse (specify --reuse-style-mixin)
-# 'tiein' - delegation-based reuse (recommended)
-# 'none' - no reuse support (specify --reuse-style-none)
-#
-XSDE_REUSE_STYLE := tiein
-
-
-# Set to 'y' if you need to handle XML vocabularies that use XML Schema
-# polymorphism (xsi:type or substitution groups). Also don't forget to
-# use either --generate-polymorphic (generates polymorphism-aware code)
-# or --runtime-polymorphic (generates non-polymorphic code that uses the
-# runtime library configured with polymorphism support). Note that support
-# for XML Schema polymorphism requires runtime static initialization
-# support in the C++ compiler (that is, support for automatic calling
-# of constructors for static objects). Furthermore, if the mixin reuse
-# style is used (XSDE_REUSE_STYLE) then the generated code requires
-# support for dynamic_cast.
-#
-XSDE_POLYMORPHIC := n
-
-
-# When polymorphism support is enabled (XSDE_POLYMORPHIC), the following
-# parameters control the substitution and inheritance hashmaps bucket
-# allocation. Because the number of elements in these hashmaps depends
-# on the schemas being compiled and thus is fairly static, these hashmaps
-# do not perform automatic table resizing. To obtain good performance the
-# elements to buckets ratio should be between 0.7 and 0.9. The recommended
-# way to ensure this range is to add diagnostics code to your application
-# as shown in the documentation and examples. It is also a good idea to
-# use prime numbers for bucket counts: 53 97 193 389 769 1543 3079 6151
-# 12289 24593 49157 98317 196613 393241. Inheritance hashmaps are only
-# used when validation is enabled.
-#
-XSDE_PARSER_SMAP_BUCKETS := 53
-XSDE_PARSER_IMAP_BUCKETS := 97
-XSDE_SERIALIZER_SMAP_BUCKETS := 53
-XSDE_SERIALIZER_SMAP_BUCKET_BUCKETS := 53
-XSDE_SERIALIZER_IMAP_BUCKETS := 97
-
-
-# Options tuning depending on the features selected.
-#
-ifeq ($(XSDE_EXCEPTIONS),y)
-CFLAGS += -fexceptions
-endif
diff --git a/dist/etc/vxworks/config-min-6.4.make b/dist/etc/vxworks/config-min-6.4.make
deleted file mode 100644
index 522771f..0000000
--- a/dist/etc/vxworks/config-min-6.4.make
+++ /dev/null
@@ -1,140 +0,0 @@
-# Sample configuration file for VxWorks 6.4 on Pentium using the
-# GNU toolchain. This configuration disables STL, iostream, and
-# C++ exceptions which can be enabled if required.
-#
-
-# Toolchain.
-#
-CC := ccpentium
-CFLAGS := -W -Wall -O3
-CPPFLAGS :=
-
-CXX := ccpentium
-CXXFLAGS := -W -Wall -O3
-
-LD := $(CXX)
-LDFLAGS := $(CXXFLAGS)
-LIBS :=
-
-# Set RANLIB to empty if your system does not need ranlib.
-#
-AR := arpentium
-ARFLAGS := rc
-RANLIB := ranlibpentium
-
-
-# Common XSD/e flags.
-#
-XSDFLAGS := --generate-inline
-
-
-# Platform. Valid values are:
-#
-# 'wince' - Windows CE
-# 'win32' - Windows 2000, XP, etc.
-# 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc.
-#
-XSDE_PLATFORM := posix
-
-
-# Platform architecture width in bits.
-#
-XSDE_ARCH_WIDTH := 32
-
-
-# Platform byte order. Valid values are 'b' for big-endian
-# and 'l' for little-endian.
-#
-XSDE_BYTEORDER := l
-
-
-# Set to 'n' if you don't have STL (std::string, etc.). Also don't
-# forget to use the --no-stl option when compiling your schemas.
-#
-XSDE_STL := n
-
-
-# Set to 'n' if you don't have iostream.
-#
-XSDE_IOSTREAM := n
-
-
-# Set to 'n' if you don't have C++ exceptions. Also don't forget to
-# use the --no-exceptions option when compiling your schemas.
-#
-XSDE_EXCEPTIONS := n
-
-
-# Set to 'n' if your platform doesn't have the "long long int" type or
-# the strtoull function. Also don't forget to use the --no-long-long
-# option when compiling your schemas.
-#
-XSDE_LONGLONG := n
-
-
-# Set to 'n' if your platform doesn't have the snprintf function.
-#
-XSDE_SNPRINTF := n
-
-
-# Set to 'n' if you don't want support for XML Schema validation in
-# C++/Parser. Also don't forget to use the --suppress-validation
-# option when compiling your schemas.
-#
-XSDE_PARSER_VALIDATION := y
-
-
-# Set to 'n' if you don't want support for XML Schema validation in
-# C++/Serializer. Also don't forget to use the --suppress-validation
-# option when compiling your schemas.
-#
-XSDE_SERIALIZER_VALIDATION := y
-
-
-# Base parser/serializer implementation reuse style. Valid values are:
-#
-# 'mixin' - virtual inheritance-based reuse (specify --reuse-style-mixin)
-# 'tiein' - delegation-based reuse (recommended)
-# 'none' - no reuse support (specify --reuse-style-none)
-#
-XSDE_REUSE_STYLE := tiein
-
-
-# Set to 'y' if you need to handle XML vocabularies that use XML Schema
-# polymorphism (xsi:type or substitution groups). Also don't forget to
-# use either --generate-polymorphic (generates polymorphism-aware code)
-# or --runtime-polymorphic (generates non-polymorphic code that uses the
-# runtime library configured with polymorphism support). Note that support
-# for XML Schema polymorphism requires runtime static initialization
-# support in the C++ compiler (that is, support for automatic calling
-# of constructors for static objects). Furthermore, if the mixin reuse
-# style is used (XSDE_REUSE_STYLE) then the generated code requires
-# support for dynamic_cast.
-#
-XSDE_POLYMORPHIC := n
-
-
-# When polymorphism support is enabled (XSDE_POLYMORPHIC), the following
-# parameters control the substitution and inheritance hashmaps bucket
-# allocation. Because the number of elements in these hashmaps depends
-# on the schemas being compiled and thus is fairly static, these hashmaps
-# do not perform automatic table resizing. To obtain good performance the
-# elements to buckets ratio should be between 0.7 and 0.9. The recommended
-# way to ensure this range is to add diagnostics code to your application
-# as shown in the documentation and examples. It is also a good idea to
-# use prime numbers for bucket counts: 53 97 193 389 769 1543 3079 6151
-# 12289 24593 49157 98317 196613 393241. Inheritance hashmaps are only
-# used when validation is enabled.
-#
-XSDE_PARSER_SMAP_BUCKETS := 53
-XSDE_PARSER_IMAP_BUCKETS := 97
-XSDE_SERIALIZER_SMAP_BUCKETS := 53
-XSDE_SERIALIZER_SMAP_BUCKET_BUCKETS := 53
-XSDE_SERIALIZER_IMAP_BUCKETS := 97
-
-
-# Options tuning depending on the features selected.
-#
-ifeq ($(XSDE_EXCEPTIONS),y)
-CFLAGS += -fexceptions
-endif
diff --git a/dist/examples/cxx/hybrid/binary/cdr/makefile b/dist/examples/cxx/hybrid/binary/cdr/makefile
new file mode 100644
index 0000000..96c6274
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/cdr/makefile
@@ -0,0 +1,58 @@
+root := ../../../../..
+
+include $(root)/build/cxx/rules.make
+
+override LIBS += -lACE
+
+# Build.
+#
+EXTRA_CPPFLAGS := -I$(root)/libxsde
+
+ifeq ($(XSDE_STL),n)
+EXTRA_XSDFLAGS += --no-stl
+endif
+
+ifeq ($(XSDE_LONGLONG),n)
+EXTRA_XSDFLAGS += --no-long-long
+endif
+
+ifeq ($(XSDE_PARSER_VALIDATION),n)
+EXTRA_XSDFLAGS += --suppress-validation
+endif
+
+ifeq ($(XSDE_REUSE_STYLE),mixin)
+EXTRA_XSDFLAGS += --reuse-style-mixin
+endif
+
+driver: driver.o library.o library-pskel.o library-pimpl.o \
+library-sskel.o library-simpl.o $(root)/libxsde/xsde/libxsde.a
+
+driver.o: driver.cxx library.hxx library-pimpl.hxx library-simpl.hxx
+library.o: library.cxx library.hxx
+library-pskel.o: library-pskel.cxx
+library-pimpl.o: library-pimpl.cxx
+library-simpl.o: library-simpl.cxx
+library-simpl.o: library-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-insertion CDR --generate-extraction CDR $<
+
+# Test.
+#
+.PHONY: test
+test: driver library.xml
+ ./driver library.xml
+
+# Clean.
+#
+.PHONY: clean
+clean:
+ rm -f library-pimpl.?xx library-pskel.?xx library-simpl.?xx \
+library-sskel.?xx library.?xx library-pimpl.o library-pskel.o \
+library-simpl.o library-sskel.o library.o driver.o driver
diff --git a/dist/examples/cxx/hybrid/binary/cdr/nmakefile b/dist/examples/cxx/hybrid/binary/cdr/nmakefile
new file mode 100644
index 0000000..a87ded2
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/cdr/nmakefile
@@ -0,0 +1,55 @@
+root = ..\..\..\..\..
+
+!include $(root)\build\cxx\rules.nmake
+
+LIBS = $(LIBS) ACE.lib
+
+# Build.
+#
+EXTRA_CPPFLAGS = /I$(root)\libxsde
+
+!if "$(XSDE_STL)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-stl
+!endif
+
+!if "$(XSDE_LONGLONG)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-long-long
+!endif
+
+!if "$(XSDE_PARSER_VALIDATION)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --suppress-validation
+!endif
+
+!if "$(XSDE_REUSE_STYLE)" == "mixin"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --reuse-style-mixin
+!endif
+
+driver.exe: driver.obj library.obj library-pskel.obj library-pimpl.obj \
+library-sskel.obj library-simpl.obj $(root)\libxsde\xsde\xsde.lib
+
+driver.obj: driver.cxx library.hxx library-pimpl.hxx library-simpl.hxx
+library.obj: library.cxx
+library-pskel.obj: library-pskel.cxx
+library-pimpl.obj: library-pimpl.cxx
+library-sskel.obj: library-sskel.cxx
+library-simpl.obj: library-simpl.cxx
+
+library.cxx library.hxx \
+library-pskel.cxx library-pskel.hxx library-pimpl.cxx library-pimpl.hxx \
+library-sskel.cxx library-sskel.hxx library-simpl.cxx library-simpl.hxx \
+: library.xsd
+ $(root)\bin\xsde.exe cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
+--generate-parser --generate-serializer --generate-aggregate \
+--generate-insertion CDR --generate-extraction CDR library.xsd
+
+# Test.
+#
+test: driver.exe library.xml
+ .\driver.exe library.xml
+
+# Clean.
+#
+clean:
+ -del library-pimpl.?xx library-pskel.?xx library-simpl.?xx \
+library-sskel.?xx library.?xx library-pimpl.obj library-pskel.obj \
+library-simpl.obj library-sskel.obj library.obj driver.obj driver.exe
diff --git a/dist/examples/cxx/hybrid/binary/custom/makefile b/dist/examples/cxx/hybrid/binary/custom/makefile
new file mode 100644
index 0000000..c0e57ad
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/custom/makefile
@@ -0,0 +1,70 @@
+root := ../../../../..
+
+include $(root)/build/cxx/rules.make
+
+# Build.
+#
+EXTRA_CPPFLAGS := -I$(root)/libxsde
+
+ifeq ($(XSDE_STL),n)
+EXTRA_XSDFLAGS += --no-stl
+endif
+
+ifeq ($(XSDE_LONGLONG),n)
+EXTRA_XSDFLAGS += --no-long-long
+endif
+
+ifeq ($(XSDE_PARSER_VALIDATION),n)
+EXTRA_XSDFLAGS += --suppress-validation
+endif
+
+ifeq ($(XSDE_REUSE_STYLE),mixin)
+EXTRA_XSDFLAGS += --reuse-style-mixin
+endif
+
+driver: driver.o library.o library-pskel.o library-pimpl.o \
+library-sskel.o library-simpl.o exceptions.o orawstream.o \
+irawstream.o $(root)/libxsde/xsde/libxsde.a
+
+driver.o: driver.cxx library.hxx library-pimpl.hxx library-simpl.hxx
+exceptions.o: exceptions.cxx
+orawstream.o: orawstream.cxx xml-schema.hxx
+irawstream.o: irawstream.cxx xml-schema.hxx
+library.o: library.cxx library.hxx
+library-pskel.o: library-pskel.cxx library-pskel.hxx
+library-pimpl.o: library-pimpl.cxx library-pskel.hxx
+library-simpl.o: library-simpl.cxx library-simpl.hxx
+library-simpl.o: library-simpl.cxx library-simpl.hxx
+
+library.hxx: xml-schema.hxx
+library-pskel.hxx: xml-schema-pskel.hxx
+library-pimpl.hxx: xml-schema-pskel.hxx
+library-sskel.hxx: xml-schema-sskel.hxx
+library-simpl.hxx: xml-schema-sskel.hxx
+
+.PRECIOUS: %.hxx %.cxx %-pskel.hxx %-pskel.cxx %-pimpl.hxx %-pimpl.cxx \
+%-sskel.hxx %-sskel.cxx %-simpl.hxx %-simpl.cxx
+
+xml-schema%hxx xml-schema-pskel%hxx xml-schema-sskel%hxx:
+ $(root)/bin/xsde cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
+--generate-parser --generate-serializer --generate-xml-schema xml-schema.xsd
+
+%.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) \
+--options-file options $<
+
+# Test.
+#
+.PHONY: test
+test: driver library.xml
+ ./driver library.xml
+
+# Clean.
+#
+.PHONY: clean
+clean:
+ rm -f xml-schema.hxx xml-schema-pskel.hxx xml-schema-sskel.hxx \
+library-pimpl.?xx library-pskel.?xx library-simpl.?xx library-sskel.?xx \
+library.?xx library-pimpl.o library-pskel.o library-simpl.o library-sskel.o \
+library.o irawstream.o orawstream.o exceptions.o driver.o driver
diff --git a/dist/examples/cxx/hybrid/binary/custom/nmakefile b/dist/examples/cxx/hybrid/binary/custom/nmakefile
new file mode 100644
index 0000000..b53db8e
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/custom/nmakefile
@@ -0,0 +1,68 @@
+root = ..\..\..\..\..
+
+!include $(root)\build\cxx\rules.nmake
+
+# Build.
+#
+EXTRA_CPPFLAGS = /I$(root)\libxsde
+
+!if "$(XSDE_STL)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-stl
+!endif
+
+!if "$(XSDE_LONGLONG)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-long-long
+!endif
+
+!if "$(XSDE_PARSER_VALIDATION)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --suppress-validation
+!endif
+
+!if "$(XSDE_REUSE_STYLE)" == "mixin"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --reuse-style-mixin
+!endif
+
+driver.exe: driver.obj library.obj library-pskel.obj library-pimpl.obj \
+library-sskel.obj library-simpl.obj exceptions.obj orawstream.obj \
+irawstream.obj $(root)\libxsde\xsde\xsde.lib
+
+driver.obj: driver.cxx library.hxx library-pimpl.hxx library-simpl.hxx
+exceptions.obj: exceptions.cxx
+orawstream.obj: orawstream.cxx xml-schema.hxx
+irawstream.obj: irawstream.cxx xml-schema.hxx
+library.obj: library.cxx library.hxx
+library-pskel.obj: library-pskel.cxx library-pskel.hxx
+library-pimpl.obj: library-pimpl.cxx library-pskel.hxx
+library-simpl.obj: library-simpl.cxx library-simpl.hxx
+library-simpl.obj: library-simpl.cxx library-simpl.hxx
+
+library.hxx: xml-schema.hxx
+library-pskel.hxx: xml-schema-pskel.hxx
+library-sskel.hxx: xml-schema-sskel.hxx
+library-sskel.hxx: xml-schema-sskel.hxx
+library-simpl.hxx: xml-schema-sskel.hxx
+
+xml-schema.hxx xml-schema-pskel.hxx xml-schema-sskel.hxx:
+ $(root)\bin\xsde.exe cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
+--generate-parser --generate-serializer --generate-xml-schema xml-schema.xsd
+
+library.cxx library.hxx \
+library-pskel.cxx library-pskel.hxx library-pimpl.cxx library-pimpl.hxx \
+library-sskel.cxx library-sskel.hxx library-simpl.cxx library-simpl.hxx \
+: library.xsd
+ $(root)\bin\xsde.exe cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
+--options-file options library.xsd
+
+# Test.
+#
+test: driver.exe library.xml
+ .\driver.exe library.xml
+
+# Clean.
+#
+clean:
+ -del xml-schema.hxx xml-schema-pskel.hxx xml-schema-sskel.hxx \
+library-pimpl.?xx library-pskel.?xx library-simpl.?xx library-sskel.?xx \
+library.?xx library-pimpl.obj library-pskel.obj library-simpl.obj \
+library-sskel.obj library.obj irawstream.obj orawstream.obj exceptions.obj \
+driver.obj driver.exe
diff --git a/dist/examples/cxx/hybrid/binary/custom/options b/dist/examples/cxx/hybrid/binary/custom/options
new file mode 100644
index 0000000..f37d345
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/custom/options
@@ -0,0 +1,8 @@
+--generate-parser
+--generate-serializer
+--generate-aggregate
+--generate-insertion orawstream
+--hxx-prologue #include "orawstream.hxx"
+--generate-extraction irawstream
+--hxx-prologue #include "irawstream.hxx"
+--extern-xml-schema xml-schema.xsd
diff --git a/dist/examples/cxx/hybrid/binary/makefile b/dist/examples/cxx/hybrid/binary/makefile
new file mode 100644
index 0000000..a683d0e
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/makefile
@@ -0,0 +1,33 @@
+root := ../../../..
+
+include $(root)/build/config.make
+
+dirs :=
+
+ifeq ($(XSDE_IOSTREAM),y)
+ifeq ($(XSDE_EXCEPTIONS),y)
+
+dirs += custom
+
+ifeq ($(XSDE_CDR),y)
+dirs += cdr
+endif
+
+ifeq ($(XSDE_XDR),y)
+dirs += xdr
+endif
+
+endif
+endif
+
+.PHONY: all $(dirs)
+
+all: $(dirs)
+
+$(dirs):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+makefile: ;
+%.make:: ;
+
+%:: $(dirs) ;
diff --git a/dist/examples/cxx/hybrid/binary/nmakefile b/dist/examples/cxx/hybrid/binary/nmakefile
new file mode 100644
index 0000000..384694a
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/nmakefile
@@ -0,0 +1,29 @@
+root = ..\..\..\..
+
+!include $(root)\build\config.nmake
+
+dirs =
+
+!if "$(XSDE_IOSTREAM)" == "y"
+!if "$(XSDE_EXCEPTIONS)" == "y"
+
+dirs = $(dirs) custom
+
+!if "$(XSDE_CDR)" == "y"
+dirs = $(dirs) cdr
+!endif
+
+!if "$(XSDE_XDR)" == "y"
+dirs = $(dirs) xdr
+!endif
+
+!endif
+!endif
+
+all:
+ @for %i in ( $(dirs) ) do \
+@cmd /c "cd %i & $(MAKE) /nologo /f nmakefile"
+
+test clean:
+ @for %i in ( $(dirs) ) do \
+@cmd /c "cd %i & $(MAKE) /nologo /f nmakefile $@"
diff --git a/dist/examples/cxx/hybrid/binary/xdr/makefile b/dist/examples/cxx/hybrid/binary/xdr/makefile
new file mode 100644
index 0000000..95ceade
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/xdr/makefile
@@ -0,0 +1,58 @@
+root := ../../../../..
+
+include $(root)/build/cxx/rules.make
+
+override LIBS += -lnsl
+
+# Build.
+#
+EXTRA_CPPFLAGS := -I$(root)/libxsde
+
+ifeq ($(XSDE_STL),n)
+EXTRA_XSDFLAGS += --no-stl
+endif
+
+ifeq ($(XSDE_LONGLONG),n)
+EXTRA_XSDFLAGS += --no-long-long
+endif
+
+ifeq ($(XSDE_PARSER_VALIDATION),n)
+EXTRA_XSDFLAGS += --suppress-validation
+endif
+
+ifeq ($(XSDE_REUSE_STYLE),mixin)
+EXTRA_XSDFLAGS += --reuse-style-mixin
+endif
+
+driver: driver.o library.o library-pskel.o library-pimpl.o \
+library-sskel.o library-simpl.o $(root)/libxsde/xsde/libxsde.a
+
+driver.o: driver.cxx library.hxx library-pimpl.hxx library-simpl.hxx
+library.o: library.cxx library.hxx
+library-pskel.o: library-pskel.cxx
+library-pimpl.o: library-pimpl.cxx
+library-simpl.o: library-simpl.cxx
+library-simpl.o: library-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-insertion XDR --generate-extraction XDR $<
+
+# Test.
+#
+.PHONY: test
+test: driver library.xml
+ ./driver library.xml
+
+# Clean.
+#
+.PHONY: clean
+clean:
+ rm -f library-pimpl.?xx library-pskel.?xx library-simpl.?xx \
+library-sskel.?xx library.?xx library-pimpl.o library-pskel.o \
+library-simpl.o library-sskel.o library.o driver.o driver
diff --git a/dist/examples/cxx/hybrid/binary/xdr/nmakefile b/dist/examples/cxx/hybrid/binary/xdr/nmakefile
new file mode 100644
index 0000000..f71e178
--- /dev/null
+++ b/dist/examples/cxx/hybrid/binary/xdr/nmakefile
@@ -0,0 +1,53 @@
+root = ..\..\..\..\..
+
+!include $(root)\build\cxx\rules.nmake
+
+# Build.
+#
+EXTRA_CPPFLAGS = /I$(root)\libxsde
+
+!if "$(XSDE_STL)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-stl
+!endif
+
+!if "$(XSDE_LONGLONG)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-long-long
+!endif
+
+!if "$(XSDE_PARSER_VALIDATION)" == "n"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --suppress-validation
+!endif
+
+!if "$(XSDE_REUSE_STYLE)" == "mixin"
+EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --reuse-style-mixin
+!endif
+
+driver.exe: driver.obj library.obj library-pskel.obj library-pimpl.obj \
+library-sskel.obj library-simpl.obj $(root)\libxsde\xsde\xsde.lib
+
+driver.obj: driver.cxx library.hxx library-pimpl.hxx library-simpl.hxx
+library.obj: library.cxx
+library-pskel.obj: library-pskel.cxx
+library-pimpl.obj: library-pimpl.cxx
+library-sskel.obj: library-sskel.cxx
+library-simpl.obj: library-simpl.cxx
+
+library.cxx library.hxx \
+library-pskel.cxx library-pskel.hxx library-pimpl.cxx library-pimpl.hxx \
+library-sskel.cxx library-sskel.hxx library-simpl.cxx library-simpl.hxx \
+: library.xsd
+ $(root)\bin\xsde.exe cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
+--generate-parser --generate-serializer --generate-aggregate \
+--generate-insertion XDR --generate-extraction XDR library.xsd
+
+# Test.
+#
+test: driver.exe library.xml
+ .\driver.exe library.xml
+
+# Clean.
+#
+clean:
+ -del library-pimpl.?xx library-pskel.?xx library-simpl.?xx \
+library-sskel.?xx library.?xx library-pimpl.obj library-pskel.obj \
+library-simpl.obj library-sskel.obj library.obj driver.obj driver.exe
diff --git a/dist/examples/cxx/hybrid/makefile b/dist/examples/cxx/hybrid/makefile
index fdcec1d..38ccd04 100644
--- a/dist/examples/cxx/hybrid/makefile
+++ b/dist/examples/cxx/hybrid/makefile
@@ -2,7 +2,7 @@ root := ../../..
include $(root)/build/config.make
-dirs := compositors
+dirs := binary compositors
ifeq ($(XSDE_IOSTREAM),y)
ifeq ($(XSDE_EXCEPTIONS),y)
diff --git a/dist/libxsde/xsde/makefile b/dist/libxsde/xsde/makefile
index 7ce4bdc..9120561 100644
--- a/dist/libxsde/xsde/makefile
+++ b/dist/libxsde/xsde/makefile
@@ -49,6 +49,25 @@ endif
##
src += cxx/hybrid/sequence.cxx
+ifeq ($(XSDE_CDR),y)
+src += \
+cxx/hybrid/cdr/exceptions.cxx \
+cxx/hybrid/cdr/istream.cxx \
+cxx/hybrid/cdr/ostream.cxx \
+cxx/hybrid/cdr/qname.cxx \
+cxx/hybrid/cdr/date-time.cxx \
+cxx/hybrid/cdr/string-sequence.cxx
+endif
+
+ifeq ($(XSDE_XDR),y)
+src += \
+cxx/hybrid/xdr/exceptions.cxx \
+cxx/hybrid/xdr/istream.cxx \
+cxx/hybrid/xdr/ostream.cxx \
+cxx/hybrid/xdr/qname.cxx \
+cxx/hybrid/xdr/date-time.cxx \
+cxx/hybrid/xdr/string-sequence.cxx
+endif
## C++/Parser
##
diff --git a/dist/libxsde/xsde/nmakefile b/dist/libxsde/xsde/nmakefile
index 5588d57..2e7e11a 100644
--- a/dist/libxsde/xsde/nmakefile
+++ b/dist/libxsde/xsde/nmakefile
@@ -51,6 +51,25 @@ src = $(src) cxx\xml\char-table.cxx cxx\xml\ncname.cxx
##
src = $(src) cxx\hybrid\sequence.cxx
+!if "$(XSDE_CDR)" == "y"
+src = $(src) \
+cxx\hybrid\cdr\exceptions.cxx \
+cxx\hybrid\cdr\istream.cxx \
+cxx\hybrid\cdr\ostream.cxx \
+cxx\hybrid\cdr\qname.cxx \
+cxx\hybrid\cdr\date-time.cxx \
+cxx\hybrid\cdr\string-sequence.cxx
+!endif
+
+!if "$(XSDE_XDR)" == "y"
+src = $(src) \
+cxx\hybrid\xdr\exceptions.cxx \
+cxx\hybrid\xdr\istream.cxx \
+cxx\hybrid\xdr\ostream.cxx \
+cxx\hybrid\xdr\qname.cxx \
+cxx\hybrid\xdr\date-time.cxx \
+cxx\hybrid\xdr\string-sequence.cxx
+!endif
## C++/Parser
##
diff --git a/documentation/cxx/hybrid/guide/index.xhtml b/documentation/cxx/hybrid/guide/index.xhtml
index b555009..9a95473 100644
--- a/documentation/cxx/hybrid/guide/index.xhtml
+++ b/documentation/cxx/hybrid/guide/index.xhtml
@@ -303,6 +303,16 @@
+
+ 7 | Binary Representation
+
+ |
+
+
@@ -398,6 +408,17 @@
that would otherwise not fit into memory.
+ Besides reading from and writing to XML, the C++/Hybrid mapping
+ also supports saving the object model to and loading it from a
+ number of predefined as well as custom binary formats. Binary
+ representations contain only the data without any meta information
+ or markup. Consequently, saving to and loading from a binary
+ format can be an order of magnitude faster as well as result
+ in a much smaller footprint compared to parsing and serializing
+ the same data in XML. Furthermore, the resulting representation
+ is normally several times smaller than the equivalent XML
+ representation.
+
The Embedded C++/Hybrid mapping was specifically designed and
optimized for mobile and embedded systems where hardware
constraints require high efficiency and economical use of
@@ -5090,6 +5111,274 @@ age: 25
+
+
+
+
+ Besides reading from and writing to XML, the C++/Hybrid mapping
+ also allows you to save the object model to and load it from a
+ number of predefined as well as custom data representation
+ formats. The predefined binary formats are CDR (Common Data
+ Representation) and XDR (eXternal Data Representation). A
+ custom format can easily be supported by providing
+ insertion and extraction operators for basic types.
+
+ Binary representations contain only the data without any meta
+ information or markup. Consequently, saving to and loading
+ from a binary representation can be an order of magnitude
+ faster as well as result in a much smaller footprint compared
+ to parsing and serializing the same data in XML. Furthermore,
+ the resulting representation is normally several times smaller
+ than the equivalent XML representation. These properties make a
+ binary representation ideal for internal data exchange and storage.
+ A typical application that uses this facility stores the data and
+ communicates within the system using a binary format and reads/writes
+ the data in XML when communicating with the outside world.
+
+ In order to request the generation of insertion and extraction
+ operators for a specific predefined or custom data representation
+ stream, you will need to use the --generate-insertion
+ and --generate-extraction
compiler options. See the
+ XSD/e
+ Compiler Command Line Manual for more information.
+
+ The XSD/e runtime provides implementations of the base insertion
+ and extraction operators for the ACE (Adaptive Communication
+ Environment) CDR streams and the XDR API. The XDR API is available
+ out of the box on most POSIX systems as part of Sun RPC. On other
+ platforms you may need to install a third-party library which
+ provides the XDR API.
+
+ The XSD/e compiler recognizes two special argument values to the
+ --generate-insertion
and --generate-extraction
+ options: CDR
and XDR
. When one of these
+ arguments is specified, the corresponding implementation from the
+ XSD/e runtime is automatically used. The following two sections
+ describe each of these two formats in more detail. It is also
+ possible to add support for saving the object model to and loading
+ it from custom data representation formats as discussed in the
+ last section of this chapter.
+
+ The saving of the object model types to a representation stream
+ is implemented with stream insertion operators
+ (operator<<
). Similarly, loading of the object
+ model from a representation stream is implemented with stream
+ extraction operators (operator>>
). The insertion
+ and extraction operators for the built-in XML Schema types as
+ well as the sequence templates are provided by the stream
+ implementation (that is, by the XSD/e runtime in case of CDR and
+ XDR and by you for custom formats). The XSD/e compiler automatically
+ generates insertion and extraction operators for the generated object
+ model types.
+
+ When C++ exceptions are enabled (Section 3.3, "C++
+ Exceptions"), the signatures of the insertion and extraction
+ operators are as follows:
+
+
+void
+operator<< (ostream&, const type&);
+
+void
+operator>> (istream&, type&);
+
+
+ The insertion and extraction errors are indicated by throwing
+ stream-specific exceptions. When C++ exceptions are disabled,
+ the signatures of the insertion and extraction operators are
+ as follows:
+
+
+bool
+operator<< (ostream&, const type&);
+
+bool
+operator>> (istream&, type&);
+
+
+ In this case the insertion and extraction operators return
+ true
if the operation was successful and
+ false
otherwise. The stream object may
+ provide additional error information.
+
+
+
+
+ When you request the generation of CDR stream insertion and extraction
+ operators, the ocdrstream
and icdrstream
+ types are defined in the xml_schema
namespace. Additionally,
+ if C++ exceptions are enabled, the cdr_exception
exception
+ is also defined in xml_schema
. The icdrstream
+ and ocdrstream
types are simple wrappers for the
+ ACE_InputCDR and ACE_OutputCDR streams. The following code fragment
+ shows how we can use these types when C++ exceptions are enabled:
+
+
+try
+{
+ const type& x = ... // Object model.
+
+ // Save to a CDR stream.
+ //
+ ACE_OutputCDR ace_ocdr;
+ xml_schema::ocdrstream ocdr (ace_ocdr);
+
+ ocdr << x;
+
+ // Load from a CDR stream.
+ //
+ ACE_InputCDR ace_icdr (buf, size);
+ xml_schema::icdrstream icdr (ace_icdr);
+
+ type copy;
+ icdr >> copy;
+}
+catch (const xml_schema::cdr_exception&)
+{
+ cerr << "CDR operation failed" << endl;
+}
+
+
+ The same code fragment but when C++ exceptions are disabled:
+
+
+const type& x = ... // Object model.
+
+// Save to a CDR stream.
+//
+ACE_OutputCDR ace_ocdr;
+xml_schema::ocdrstream ocdr (ace_ocdr);
+
+if (!(ocdr << x))
+{
+ cerr << "CDR operation failed" << endl;
+}
+
+// Load from a CDR stream.
+//
+ACE_InputCDR ace_icdr (buf, size);
+xml_schema::icdrstream icdr (ace_icdr);
+
+type copy;
+
+if (!(icdr >> copy))
+{
+ cerr << "CDR operation failed" << endl;
+}
+
+
+ The cdr
example which can be found in the
+ examples/cxx/hybrid/binary/
directory of the XSD/e
+ distribution includes complete source code that shows how to
+ save the object model to and load it from the CDR format.
+
+
+
+ When you request the generation of XDR stream insertion and extraction
+ operators, the oxdrstream
and xcdrstream
+ types are defined in the xml_schema
namespace. Additionally,
+ if C++ exceptions are enabled, the xdr_exception
exception
+ is also defined in xml_schema
. The ixdrstream
+ and oxdrstream
types are simple wrappers for the XDR
+ API. The following code fragment shows how we can use these types
+ when C++ exceptions are enabled:
+
+
+try
+{
+ const type& x = ... // Object model.
+
+ // Save to a XDR stream.
+ //
+ XDR xdr;
+ xdrrec_create (&xdr, ...);
+ xml_schema::oxdrstream oxdr (xdr);
+
+ oxdr << x;
+
+ // Load from a XDR stream.
+ //
+ xdrrec_create (&xdr, ...);
+ xml_schema::ixdrstream ixdr (xdr);
+
+ type copy;
+ ixdr >> copy;
+}
+catch (const xml_schema::xdr_exception&)
+{
+ cerr << "XDR operation failed" << endl;
+}
+
+
+ The same code fragment but when C++ exceptions are disabled:
+
+
+const type& x = ... // Object model.
+
+// Save to a XDR stream.
+//
+XDR xdr;
+xdrrec_create (&xdr, ...);
+xml_schema::oxdrstream oxdr (xdr);
+
+if (!(oxdr << x))
+{
+ cerr << "XDR operation failed" << endl;
+}
+
+// Load from a XDR stream.
+//
+xdrrec_create (&xdr, ...);
+xml_schema::ixdrstream ixdr (xdr);
+
+type copy;
+
+if (!(ixdr >> copy))
+{
+ cerr << "XDR operation failed" << endl;
+}
+
+
+ The xdr
example which can be found in the
+ examples/cxx/hybrid/binary/
directory of the XSD/e
+ distribution includes complete source code that shows how to
+ save the object model to and load it from the XDR format.
+
+
+
+
+ To add support for saving the object model to and loading it
+ from a custom format, you will need to perform the following
+ general steps:
+
+
+ - Generate a header file corresponding to the XML Schema
+ namespace using the
--generate-xml-schema
+ compiler option.
+
+ - Implement custom stream insertion and extraction operators
+ for the built-in XML Schema types and sequence templates.
+ Include the header file obtained in the previous step to
+ get definitions for these types.
+
+ - Compile your schemas with the
--generate-insertion
+ and --generate-extraction
options. The arguments
+ to these options will be your custom output and input stream
+ types, respectively. Use the --hxx-prologue
+ option to include the definitions for these stream types
+ into the generated code. Also use the
+ --extern-xml-schema
option to include the
+ header file obtained in the first step instead of generating
+ the same code directly.
+
+
+ The custom
example which can be found in the
+ examples/cxx/hybrid/binary/
directory of the XSD/e
+ distribution includes complete source code that shows how to
+ save the object model to and load it from a custom format using
+ the raw binary representation as an example. You can use the
+ source code from this example as a base to implement support
+ for your own format.
diff --git a/documentation/xsde.1 b/documentation/xsde.1
index 1f72eef..79a9179 100644
--- a/documentation/xsde.1
+++ b/documentation/xsde.1
@@ -944,6 +944,34 @@ Suppress the generation of validation code in parser.
.IP "\fB\--suppress-serializer-val\fR"
Suppress the generation of validation code in serializer.
+.IP "\fB\--generate-insertion \fIos\fR"
+Generate data representation stream insertion operators for the
+.I os
+output stream type. Repeat this option to specify more than one stream
+type. The special
+.B CDR
+and
+.B XDR
+arguments are recognized as ACE CDR and Sun RPC XDR stream types and the
+corresponding stream wrappers provided by the XSD/e runtime are automatically
+used. For custom stream types use the
+.B --hxx-prologue*
+options to include the necessary declarations.
+
+.IP "\fB\--generate-extraction \fIis\fR"
+Generate data representation stream extraction operators for the
+.I is
+input stream type. Repeat this option to specify more than one stream
+type. The special
+.B CDR
+and
+.B XDR
+arguments are recognized as ACE CDR and Sun RPC XDR stream types and the
+corresponding stream wrappers provided by the XSD/e runtime are automatically
+used. For custom stream types use the
+.B --hxx-prologue*
+options to include the necessary declarations.
+
.IP "\fB\--generate-forward\fR"
Generate forward declaration file.
diff --git a/documentation/xsde.xhtml b/documentation/xsde.xhtml
index ac01b91..d07197b 100644
--- a/documentation/xsde.xhtml
+++ b/documentation/xsde.xhtml
@@ -816,6 +816,28 @@
--suppress-serializer-val
Suppress the generation of validation code in serializer.
+ --generate-insertion os
+ Generate data representation stream insertion operators for
+ the os
output stream type. Repeat this
+ option to specify more than one stream type. The special
+ CDR
and XDR
arguments
+ are recognized as ACE CDR and Sun RPC XDR stream types and
+ the corresponding stream wrappers provided by the XSD/e runtime
+ are automatically used. For custom stream types use the
+ --hxx-prologue*
options to include the
+ necessary declarations.
+
+ --generate-extraction is
+ Generate data representation stream extraction operators for
+ the is
input stream type. Repeat this
+ option to specify more than one stream type. The special
+ CDR
and XDR
arguments
+ are recognized as ACE CDR and Sun RPC XDR stream types and
+ the corresponding stream wrappers provided by the XSD/e runtime
+ are automatically used. For custom stream types use the
+ --hxx-prologue*
options to include the
+ necessary declarations.
+
--generate-forward
Generate forward declaration file.
diff --git a/examples/cxx/hybrid/README b/examples/cxx/hybrid/README
index ee55a90..2008450 100644
--- a/examples/cxx/hybrid/README
+++ b/examples/cxx/hybrid/README
@@ -35,3 +35,7 @@ streaming
compositors
Shows how to create, access, and modify object models with complex
nested choice and sequence compositors.
+
+binary/
+ A collection of examples that show how to serialize the object model
+ into a number of predefined and custom binary formats.
diff --git a/examples/cxx/hybrid/binary/README b/examples/cxx/hybrid/binary/README
new file mode 100644
index 0000000..73e3491
--- /dev/null
+++ b/examples/cxx/hybrid/binary/README
@@ -0,0 +1,16 @@
+This directory contains a number of examples that show how to serialize
+the object model into a number of predefined and custom binary formats.
+The following list gives an overview of each example:
+
+cdr
+ Shows how to save/load the object model to/from CDR (Common Data
+ Representation) binary format using ACE CDR streams.
+
+xdr
+ Shows how to save/load the object model to/from XDR (eXternal Data
+ Representation) binary format using the XDR API provided as part of
+ Sun RPC.
+
+custom
+ Shows how to save/load the C++/Hybrid object model to/from a custom
+ format using the raw binary representation as an example.
diff --git a/examples/cxx/hybrid/binary/cdr/README b/examples/cxx/hybrid/binary/cdr/README
new file mode 100644
index 0000000..52045f0
--- /dev/null
+++ b/examples/cxx/hybrid/binary/cdr/README
@@ -0,0 +1,51 @@
+This example shows how to save/load the C++/Hybrid object model to/from
+CDR (Common Data Representation) binary format using ACE CDR streams.
+You will need the ACE library installed in order to build and run this
+example:
+
+http://www.cs.wustl.edu/~schmidt/ACE.html
+
+The example consists of the following files:
+
+library.xsd
+ XML Schema which describes a library of books.
+
+library.xml
+ Sample XML instance document.
+
+library.hxx
+library.cxx
+
+library-pskel.hxx
+library-pskel.cxx
+library-pimpl.hxx
+library-pimpl.cxx
+
+library-pskel.hxx
+library-pskel.cxx
+library-pimpl.hxx
+library-pimpl.cxx
+ Object model (the first pair of files), parser skeletons (the
+ second pair), parser implementations (the third pair), serializer
+ skeletons (the fourth pair), and serializer implementations (the
+ fifth pair). These files are generated by the XSD/e compiler from
+ library.xsd. The --generate-parser, --generate-serializer, and
+ --generate-aggregate options were used to request the generation
+ of the parsing and serialization code. The --generate-insertion and
+ --generate-extraction options were used to generate the insertion
+ and extraction operations for the CDR streams.
+
+driver.cxx
+ Driver for the example. It first calls the parser that constructs
+ the object model from the input XML file. It then saves the object
+ model to the CDR representation and loads it back. Finally, the
+ driver calls the serializer to serialize the loaded object model
+ back to XML.
+
+To run the example on the sample XML instance document simply execute:
+
+$ ./driver library.xml
+
+The example reads from STDIN if input file is not specified:
+
+$ ./driver
+// copyright : not copyrighted - public domain
+
+#include // memcpy
+
+#include // std::auto_ptr
+#include
+
+#include // ACE_HEX_DUMP
+#include
+
+#include "library.hxx"
+#include "library-pimpl.hxx"
+#include "library-simpl.hxx"
+
+using std::cerr;
+using std::endl;
+
+int
+main (int argc, char* argv[])
+{
+ const char* input;
+
+ if (argc < 2)
+ {
+ input = "STDIN";
+ cerr << "XML file not specified, reading from STDIN" << endl;
+ }
+ else
+ input = argv[1];
+
+ try
+ {
+ using namespace library;
+
+ // Parse.
+ //
+ catalog_paggr catalog_p;
+
+ xml_schema::document_pimpl doc_p (
+ catalog_p.root_parser (),
+ catalog_p.root_namespace (),
+ catalog_p.root_name ());
+
+ catalog_p.pre ();
+
+ if (argc < 2)
+ doc_p.parse (std::cin);
+ else
+ doc_p.parse (argv[1]);
+
+ std::auto_ptr c (catalog_p.post ());
+
+ // Save the object model to a CDR stream.
+ //
+ ACE_OutputCDR ace_ocdr;
+ xml_schema::ocdrstream ocdr (ace_ocdr);
+ ocdr << *c;
+
+ // Print the binary representation and at the same time save
+ // it into a continuous buffer.
+ //
+ cerr << "binary representation size: " << ace_ocdr.total_length () << endl
+ << endl;
+
+ xml_schema::buffer buf (ace_ocdr.total_length ());
+ char* data = buf.data ();
+
+ for (const ACE_Message_Block* mb = ace_ocdr.begin ();
+ mb != 0;
+ mb = mb->cont ())
+ {
+ memcpy (data, mb->rd_ptr (), mb->length ());
+ data += mb->length ();
+
+ ACE_HEX_DUMP ((LM_DEBUG, mb->rd_ptr (), mb->length ()));
+ }
+
+ // Load the object model from a CDR stream. Note that ACE_InputCDR
+ // expects the buffer to be properly aligned. Since our buffer is
+ // dynamically allocated, its alignment should be good enough.
+ //
+ ACE_InputCDR ace_icdr (buf.data (), buf.size ());
+ xml_schema::icdrstream icdr (ace_icdr);
+ std::auto_ptr copy (new catalog);
+ icdr >> *copy;
+
+ // Serialize the copy back to XML.
+ //
+ catalog_saggr catalog_s;
+
+ xml_schema::document_simpl doc_s (
+ catalog_s.root_serializer (),
+ catalog_s.root_namespace (),
+ catalog_s.root_name ());
+
+ doc_s.add_prefix ("lib", "http://www.codesynthesis.com/library");
+ doc_s.add_schema ("http://www.codesynthesis.com/library", "library.xsd");
+
+ catalog_s.pre (*c);
+ doc_s.serialize (std::cout);
+ catalog_s.post ();
+ }
+ catch (const xml_schema::cdr_exception&)
+ {
+ cerr << "CDR operation failed" << endl;
+ return 1;
+ }
+ catch (const xml_schema::parser_exception& e)
+ {
+ cerr << input << ":" << e.line () << ":" << e.column () << ": "
+ << e.text () << endl;
+ return 1;
+ }
+ catch (const xml_schema::serializer_exception& e)
+ {
+ cerr << "error: " << e.text () << endl;
+ return 1;
+ }
+ catch (const std::ios_base::failure&)
+ {
+ cerr << input << ": unable to open or read/write failure" << endl;
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/examples/cxx/hybrid/binary/cdr/library.xml b/examples/cxx/hybrid/binary/cdr/library.xml
new file mode 100644
index 0000000..6bfb4d8
--- /dev/null
+++ b/examples/cxx/hybrid/binary/cdr/library.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+ 0679760806
+ The Master and Margarita
+ fiction
+
+
+ Mikhail Bulgakov
+ 1891-05-15
+ 1940-03-10
+
+
+
+
+
+ 0679600841
+ War and Peace
+ history
+
+
+ Leo Tolstoy
+ 1828-09-09
+ 1910-11-20
+
+
+
+
+
+ 0679420290
+ Crime and Punishment
+ philosophy
+
+
+ Fyodor Dostoevsky
+ 1821-11-11
+ 1881-02-09
+
+
+
+
diff --git a/examples/cxx/hybrid/binary/cdr/library.xsd b/examples/cxx/hybrid/binary/cdr/library.xsd
new file mode 100644
index 0000000..0b0d9d1
--- /dev/null
+++ b/examples/cxx/hybrid/binary/cdr/library.xsd
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/cxx/hybrid/binary/cdr/makefile b/examples/cxx/hybrid/binary/cdr/makefile
new file mode 100644
index 0000000..eba1c77
--- /dev/null
+++ b/examples/cxx/hybrid/binary/cdr/makefile
@@ -0,0 +1,112 @@
+# file : examples/cxx/hybrid/binary/cdr/makefile
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
+
+xsd := library.xsd
+cxx := driver.cxx
+
+obj := $(addprefix $(out_base)/,\
+$(cxx:.cxx=.o) \
+$(xsd:.xsd=.o) \
+$(xsd:.xsd=-pskel.o) \
+$(xsd:.xsd=-pimpl.o) \
+$(xsd:.xsd=-sskel.o) \
+$(xsd:.xsd=-simpl.o))
+
+dep := $(obj:.o=.o.d)
+
+xsde.l := $(out_root)/libxsde/xsde/xsde.l
+xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options
+
+driver := $(out_base)/driver
+dist := $(out_base)/.dist
+dist-win := $(out_base)/.dist-win
+clean := $(out_base)/.clean
+
+# Build.
+#
+$(driver): $(obj) $(xsde.l)
+
+$(obj) $(dep): $(xsde.l.cpp-options)
+
+genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.cxx) \
+ $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.cxx) \
+ $(xsd:.xsd=-pimpl.hxx) $(xsd:.xsd=-pimpl.cxx) \
+ $(xsd:.xsd=-sskel.hxx) $(xsd:.xsd=-sskel.cxx) \
+ $(xsd:.xsd=-simpl.hxx) $(xsd:.xsd=-simpl.cxx)
+
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(out_root)/xsde/xsde
+$(gen): xsde := $(out_root)/xsde/xsde
+$(gen): xsde_options += --generate-parser --generate-serializer \
+--generate-aggregate --generate-insertion CDR --generate-extraction CDR
+
+$(call include-dep,$(dep))
+
+# Convenience alias for default target.
+#
+.PHONY: $(out_base)/
+$(out_base)/: $(driver)
+
+
+# Dist.
+#
+dist-common := $(out_base)/.dist-common
+
+.PHONY: $(dist) $(dist-win) $(dist-common)
+
+$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base))
+
+$(dist-common):
+ $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx)
+ $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd)
+ $(call install-data,$(src_base)/library.xml,$(dist_prefix)/$(path)/library.xml)
+
+$(dist): $(dist-common)
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README)
+
+$(dist-win): $(dist-common)
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt)
+ $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt)
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(obj)) \
+ $(addsuffix .cxx.clean,$(dep)) \
+ $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean))
+
+
+# Generated .gitignore.
+#
+ifeq ($(out_base),$(src_base))
+$(gen): | $(out_base)/.gitignore
+$(driver): | $(out_base)/.gitignore
+
+$(out_base)/.gitignore: files := driver $(genf)
+$(clean): $(out_base)/.gitignore.clean
+
+$(call include,$(bld_root)/git/gitignore.make)
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-e.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/install.make)
+$(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make)
+
+
+# Dependencies.
+#
+$(call import,$(src_root)/xsde/makefile)
+$(call import,$(src_root)/libxsde/xsde/makefile)
diff --git a/examples/cxx/hybrid/binary/custom/README b/examples/cxx/hybrid/binary/custom/README
new file mode 100644
index 0000000..b7475d8
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/README
@@ -0,0 +1,77 @@
+This example shows how to save/load the C++/Hybrid object model to/from
+a custom format using the raw binary representation as an example. Note
+that if you would like to use this format in your applications, make sure
+that all the targets use exactly the same base type sizes (e.g., int, long,
+float, double, size_t, etc.) and byte order.
+
+The example consists of the following files:
+
+library.xsd
+ XML Schema which describes a library of books.
+
+library.xml
+ Sample XML instance document.
+
+xml-schema.hxx
+xml-schema-pskel.hxx
+xml-schema-sskel.hxx
+ Base object model types (the first file), parser skeletons (the second
+ file), and serializer skeletons (the third file) for the XML Schema
+ built-in types. These header files are generated by the XSD/e compiler
+ using the --generate-xml-schema option. The --generate-parser and
+ --generate-serializer options were also specified.
+
+irawstream.hxx
+irawstream.ixx
+irawstream.txx
+irawstream.cxx
+
+orawstream.hxx
+orawstream.ixx
+orawstream.txx
+orawstream.cxx
+ Implementation of the raw binary representation streams. The header
+ files include xml-schema.hxx to gain access to the base object model
+ types. You can use this implementation as a base for your custom
+ format.
+
+library.hxx
+library.cxx
+
+library-pskel.hxx
+library-pskel.cxx
+library-pimpl.hxx
+library-pimpl.cxx
+
+library-pskel.hxx
+library-pskel.cxx
+library-pimpl.hxx
+library-pimpl.cxx
+ Object model (the first pair of files), parser skeletons (the second
+ pair), parser implementations (the third pair), serializer skeletons
+ (the fourth pair), and serializer implementations (the fifth pair).
+ These files are generated by the XSD/e compiler from library.xsd. The
+ --generate-parser, --generate-serializer, and --generate-aggregate
+ options were used to request the generation of the parsing and
+ serialization code. The --generate-insertion and --generate-extraction
+ options were used to generate the insertion and extraction operations
+ for the orawstream and irawstream, respectively. The --hxx-prologue
+ option was used to include the orawstream.hxx and irawstream.hxx
+ header files at the beginning of library.hxx. Finally, the
+ --extern-xml-schema option was used to include xml-schema* files
+ instead of generating the same code directly.
+
+driver.cxx
+ Driver for the example. It first calls the parser that constructs
+ the object model from the input XML file. It then saves the object
+ model to the raw binary representation and loads it back. Finally,
+ the driver calls the serializer to serialize the loaded object model
+ back to XML.
+
+To run the example on the sample XML instance document simply execute:
+
+$ ./driver library.xml
+
+The example reads from STDIN if input file is not specified:
+
+$ ./driver
+// copyright : not copyrighted - public domain
+
+#include // std::auto_ptr
+#include
+
+#include "orawstream.hxx"
+#include "irawstream.hxx"
+
+#include "library.hxx"
+#include "library-pimpl.hxx"
+#include "library-simpl.hxx"
+
+using std::cerr;
+using std::endl;
+
+int
+main (int argc, char* argv[])
+{
+ const char* input;
+
+ if (argc < 2)
+ {
+ input = "STDIN";
+ cerr << "XML file not specified, reading from STDIN" << endl;
+ }
+ else
+ input = argv[1];
+
+ try
+ {
+ using namespace library;
+
+ // Parse.
+ //
+ catalog_paggr catalog_p;
+
+ xml_schema::document_pimpl doc_p (
+ catalog_p.root_parser (),
+ catalog_p.root_namespace (),
+ catalog_p.root_name ());
+
+ catalog_p.pre ();
+
+ if (argc < 2)
+ doc_p.parse (std::cin);
+ else
+ doc_p.parse (argv[1]);
+
+ std::auto_ptr c (catalog_p.post ());
+
+ // Save the object model to a RAW stream.
+ //
+ xml_schema::buffer buf;
+ orawstream oraw (buf);
+ oraw << *c;
+
+ cerr << "binary representation size: " << buf.size () << endl
+ << endl;
+
+ // Load the object model from a RAW stream.
+ //
+ irawstream iraw (buf);
+ std::auto_ptr copy (new catalog);
+ iraw >> *copy;
+
+ // Serialize the copy back to XML.
+ //
+ catalog_saggr catalog_s;
+
+ xml_schema::document_simpl doc_s (
+ catalog_s.root_serializer (),
+ catalog_s.root_namespace (),
+ catalog_s.root_name ());
+
+ doc_s.add_prefix ("lib", "http://www.codesynthesis.com/library");
+ doc_s.add_schema ("http://www.codesynthesis.com/library", "library.xsd");
+
+ catalog_s.pre (*c);
+ doc_s.serialize (std::cout);
+ catalog_s.post ();
+ }
+ catch (const raw_exception&)
+ {
+ cerr << "RAW stream operation failed" << endl;
+ return 1;
+ }
+ catch (const xml_schema::parser_exception& e)
+ {
+ cerr << input << ":" << e.line () << ":" << e.column () << ": "
+ << e.text () << endl;
+ return 1;
+ }
+ catch (const xml_schema::serializer_exception& e)
+ {
+ cerr << "error: " << e.text () << endl;
+ return 1;
+ }
+ catch (const std::ios_base::failure&)
+ {
+ cerr << input << ": unable to open or read/write failure" << endl;
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/examples/cxx/hybrid/binary/custom/exceptions.cxx b/examples/cxx/hybrid/binary/custom/exceptions.cxx
new file mode 100644
index 0000000..0ad8c4b
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/exceptions.cxx
@@ -0,0 +1,11 @@
+// file : examples/cxx/hybrid/binary/custom/exceptions.cxx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#include "exceptions.hxx"
+
+const char* raw_exception::
+what () const throw ()
+{
+ return "RAW stream operation failed";
+}
diff --git a/examples/cxx/hybrid/binary/custom/exceptions.hxx b/examples/cxx/hybrid/binary/custom/exceptions.hxx
new file mode 100644
index 0000000..0111799
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/exceptions.hxx
@@ -0,0 +1,16 @@
+// file : examples/cxx/hybrid/binary/custom/exceptions.hxx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#ifndef EXCEPTIONS_HXX
+#define EXCEPTIONS_HXX
+
+#include // std::exception
+
+struct raw_exception: std::exception
+{
+ virtual const char*
+ what () const throw ();
+};
+
+#endif // EXCEPTIONS_HXX
diff --git a/examples/cxx/hybrid/binary/custom/irawstream.cxx b/examples/cxx/hybrid/binary/custom/irawstream.cxx
new file mode 100644
index 0000000..d3d6aae
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/irawstream.cxx
@@ -0,0 +1,296 @@
+// file : examples/cxx/hybrid/binary/custom/irawstream.cxx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#include // memcpy
+
+#include "irawstream.hxx"
+
+using namespace xml_schema;
+
+const char* irawstream::
+align (size_t a, size_t n)
+{
+ size_t r = pos_ % a;
+
+ if (r)
+ n += a - r;
+
+ if (buf_.size () - pos_ < n)
+ throw raw_exception ();
+
+ const char* p = buf_.data () + pos_;
+
+ if (r)
+ p += a - r;
+
+ pos_ += n;
+ return p;
+}
+
+void irawstream::
+operator>> (std::string& x)
+{
+ size_t n = *reinterpret_cast (
+ align (sizeof (size_t), sizeof (size_t)));
+
+ x.clear ();
+
+ if (n != 0)
+ {
+ x.resize (n);
+ memcpy (const_cast (x.c_str ()), align (1, n), n);
+ }
+}
+
+void irawstream::
+operator>> (buffer& x)
+{
+ size_t n = *reinterpret_cast (
+ align (sizeof (size_t), sizeof (size_t)));
+
+ x.size (n);
+
+ if (n != 0)
+ memcpy (x.data (), align (1, n), n);
+}
+
+void
+operator>> (irawstream& s, str_seq& x)
+{
+ size_t n;
+ irawstream::as_size as_size (n);
+ s >> as_size;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ x.reserve (n);
+ std::string i;
+
+ while (n--)
+ {
+ s >> i;
+ x.push_back (i);
+ }
+ }
+}
+
+void
+operator>> (irawstream& s, qname& x)
+{
+ std::string p, n;
+
+ s >> p;
+ s >> n;
+
+ x.prefix (p);
+ x.name (n);
+}
+
+void
+operator>> (irawstream& s, time_zone& x)
+{
+ short h, m;
+ s >> h;
+ s >> m;
+
+ x.zone_hours (h);
+ x.zone_minutes (m);
+}
+
+void
+operator>> (irawstream& s, date& x)
+{
+ int y;
+ unsigned short m, d;
+ bool zp;
+
+ s >> y;
+ s >> m;
+ s >> d;
+ s >> zp;
+
+ x.year (y);
+ x.month (m);
+ x.day (d);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
+
+void
+operator>> (irawstream& s, date_time& x)
+{
+ int y;
+ unsigned short m, d, h, mi;
+ double se;
+ bool zp;
+
+ s >> y;
+ s >> m;
+ s >> d;
+ s >> h;
+ s >> mi;
+ s >> se;
+ s >> zp;
+
+ x.year (y);
+ x.month (m);
+ x.day (d);
+ x.hours (h);
+ x.minutes (mi);
+ x.seconds (se);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
+
+void
+operator>> (irawstream& s, duration& x)
+{
+ bool n;
+ unsigned int y, m, d, h, mi;
+ double se;
+
+ s >> n;
+ s >> y;
+ s >> m;
+ s >> d;
+ s >> h;
+ s >> mi;
+ s >> se;
+
+ x.negative (n);
+ x.years (y);
+ x.months (m);
+ x.days (d);
+ x.hours (h);
+ x.minutes (mi);
+ x.seconds (se);
+}
+
+void
+operator>> (irawstream& s, gday& x)
+{
+ unsigned short d;
+ bool zp;
+
+ s >> d;
+ s >> zp;
+
+ x.day (d);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
+
+void
+operator>> (irawstream& s, gmonth& x)
+{
+ unsigned short m;
+ bool zp;
+
+ s >> m;
+ s >> zp;
+
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
+
+void
+operator>> (irawstream& s, gmonth_day& x)
+{
+ unsigned short d, m;
+ bool zp;
+
+ s >> d;
+ s >> m;
+ s >> zp;
+
+ x.day (d);
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
+
+void
+operator>> (irawstream& s, gyear& x)
+{
+ int y;
+ bool zp;
+
+ s >> y;
+ s >> zp;
+
+ x.year (y);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
+
+void
+operator>> (irawstream& s, gyear_month& x)
+{
+ int y;
+ unsigned short m;
+ bool zp;
+
+ s >> y;
+ s >> m;
+ s >> zp;
+
+ x.year (y);
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
+
+void
+operator>> (irawstream& s, xml_schema::time& x)
+{
+ unsigned short h, m;
+ double se;
+ bool zp;
+
+ s >> h;
+ s >> m;
+ s >> se;
+ s >> zp;
+
+ x.hours (h);
+ x.minutes (m);
+ x.seconds (se);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+}
diff --git a/examples/cxx/hybrid/binary/custom/irawstream.hxx b/examples/cxx/hybrid/binary/custom/irawstream.hxx
new file mode 100644
index 0000000..94d2382
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/irawstream.hxx
@@ -0,0 +1,92 @@
+// file : examples/cxx/hybrid/binary/custom/irawstream.hxx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#ifndef IRAWSTREAM_HXX
+#define IRAWSTREAM_HXX
+
+#include // size_t
+
+#include
+
+#include "exceptions.hxx"
+#include "xml-schema.hxx"
+
+class irawstream
+{
+public:
+ explicit
+ irawstream (const xml_schema::buffer&, size_t start = 0);
+
+public:
+ struct as_size
+ {
+ explicit as_size (size_t& s) : s_ (s) {}
+ size_t& s_;
+ };
+
+public:
+ void operator>> (bool&);
+ void operator>> (signed char&);
+ void operator>> (unsigned char&);
+ void operator>> (short&);
+ void operator>> (unsigned short&);
+ void operator>> (int&);
+ void operator>> (unsigned int&);
+ void operator>> (long&);
+ void operator>> (unsigned long&);
+
+#ifdef XSDE_LONGLONG
+ void operator>> (long long&);
+ void operator>> (unsigned long long&);
+#endif
+
+ void operator>> (as_size&);
+ void operator>> (float&);
+ void operator>> (double&);
+
+ void operator>> (std::string&);
+ void operator>> (xml_schema::buffer&);
+
+private:
+ irawstream (const irawstream&);
+ irawstream& operator= (const irawstream&);
+
+public:
+ const char*
+ align (size_t alignment, size_t size);
+
+private:
+ const xml_schema::buffer& buf_;
+ size_t pos_;
+};
+
+void operator>> (irawstream&, xml_schema::any_type&);
+void operator>> (irawstream&, xml_schema::any_simple_type&);
+void operator>> (irawstream&, xml_schema::qname&);
+void operator>> (irawstream&, xml_schema::time_zone&);
+void operator>> (irawstream&, xml_schema::date&);
+void operator>> (irawstream&, xml_schema::date_time&);
+void operator>> (irawstream&, xml_schema::duration&);
+void operator>> (irawstream&, xml_schema::gday&);
+void operator>> (irawstream&, xml_schema::gmonth&);
+void operator>> (irawstream&, xml_schema::gmonth_day&);
+void operator>> (irawstream&, xml_schema::gyear&);
+void operator>> (irawstream&, xml_schema::gyear_month&);
+void operator>> (irawstream&, xml_schema::time&);
+
+void operator>> (irawstream&, xml_schema::str_seq&);
+
+template
+void operator>> (irawstream&, xml_schema::pod_seq&);
+
+template
+void operator>> (irawstream&, xml_schema::fix_seq&);
+
+template
+void operator>> (irawstream&, xml_schema::var_seq&);
+
+#include "irawstream.ixx"
+#include "irawstream.txx"
+
+#endif // IRAWSTREAM_HXX
diff --git a/examples/cxx/hybrid/binary/custom/irawstream.ixx b/examples/cxx/hybrid/binary/custom/irawstream.ixx
new file mode 100644
index 0000000..bc9ff9a
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/irawstream.ixx
@@ -0,0 +1,110 @@
+// file : examples/cxx/hybrid/binary/custom/irawstream.ixx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+inline irawstream::
+irawstream (const xml_schema::buffer& buf, size_t start)
+ : buf_ (buf), pos_ (start)
+{
+}
+
+inline void irawstream::
+operator>> (bool& x)
+{
+ x = *align (1, 1);
+}
+
+inline void irawstream::
+operator>> (signed char& x)
+{
+ x = *reinterpret_cast (align (1, 1));
+}
+
+inline void irawstream::
+operator>> (unsigned char& x)
+{
+ x = *reinterpret_cast (align (1, 1));
+}
+
+inline void irawstream::
+operator>> (short& x)
+{
+ x = *reinterpret_cast (align (2, 2));
+}
+
+inline void irawstream::
+operator>> (unsigned short& x)
+{
+ x = *reinterpret_cast (align (2, 2));
+}
+
+inline void irawstream::
+operator>> (int& x)
+{
+ x = *reinterpret_cast (align (4, 4));
+}
+
+inline void irawstream::
+operator>> (unsigned int& x)
+{
+ x = *reinterpret_cast (align (4, 4));
+}
+
+inline void irawstream::
+operator>> (long& x)
+{
+ x = *reinterpret_cast (
+ align (sizeof (long), sizeof (long)));
+}
+
+inline void irawstream::
+operator>> (unsigned long& x)
+{
+ x = *reinterpret_cast (
+ align (sizeof (unsigned long), sizeof (unsigned long)));
+}
+
+#ifdef XSDE_LONGLONG
+inline void irawstream::
+operator>> (long long& x)
+{
+ x = *reinterpret_cast (align (8, 8));
+}
+
+inline void irawstream::
+operator>> (unsigned long long& x)
+{
+ x = *reinterpret_cast (align (8, 8));
+}
+#endif
+
+inline void irawstream::
+operator>> (as_size& x)
+{
+ x.s_ = *reinterpret_cast (
+ align (sizeof (size_t), sizeof (size_t)));
+}
+
+inline void irawstream::
+operator>> (float& x)
+{
+ x = *reinterpret_cast (
+ align (sizeof (float), sizeof (float)));
+}
+
+inline void irawstream::
+operator>> (double& x)
+{
+ x = *reinterpret_cast (
+ align (sizeof (double), sizeof (double)));
+}
+
+inline void
+operator>> (irawstream&, xml_schema::any_type&)
+{
+}
+
+inline void
+operator>> (irawstream&, xml_schema::any_simple_type&)
+{
+}
diff --git a/examples/cxx/hybrid/binary/custom/irawstream.txx b/examples/cxx/hybrid/binary/custom/irawstream.txx
new file mode 100644
index 0000000..2d4965e
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/irawstream.txx
@@ -0,0 +1,72 @@
+// file : examples/cxx/hybrid/binary/custom/irawostream.txx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#include // memcpy
+
+template
+void
+operator>> (irawstream& s, xml_schema::pod_seq& x)
+{
+ size_t n;
+ irawstream::as_size as_size (n);
+ s >> as_size;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ x.reserve (n);
+ size_t mn = sizeof (T) * n;
+ memcpy (x.data_, s.align (sizeof (T), mn), mn);
+ x.size_ = n;
+ }
+}
+
+template
+void
+operator>> (irawstream& s, xml_schema::fix_seq& x)
+{
+ size_t n;
+ irawstream::as_size as_size (n);
+ s >> as_size;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ x.reserve (n);
+
+ while (n--)
+ {
+ T i;
+ s >> i;
+ x.push_back (i);
+ }
+ }
+}
+
+template
+void
+operator>> (irawstream& s, xml_schema::var_seq& x)
+{
+ size_t n;
+ irawstream::as_size as_size (n);
+ s >> as_size;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ x.reserve (n);
+
+ while (n--)
+ {
+ T* p = new T;
+ typename xml_schema::var_seq::guard g (p);
+ s >> *p;
+ g.release ();
+ x.push_back (p);
+ }
+ }
+}
diff --git a/examples/cxx/hybrid/binary/custom/library.xml b/examples/cxx/hybrid/binary/custom/library.xml
new file mode 100644
index 0000000..e93bab4
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/library.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+ 0679760806
+ The Master and Margarita
+ fiction
+
+
+ Mikhail Bulgakov
+ 1891-05-15
+ 1940-03-10
+
+
+
+
+
+ 0679600841
+ War and Peace
+ history
+
+
+ Leo Tolstoy
+ 1828-09-09
+ 1910-11-20
+
+
+
+
+
+ 0679420290
+ Crime and Punishment
+ philosophy
+
+
+ Fyodor Dostoevsky
+ 1821-11-11
+ 1881-02-09
+
+
+
+
diff --git a/examples/cxx/hybrid/binary/custom/library.xsd b/examples/cxx/hybrid/binary/custom/library.xsd
new file mode 100644
index 0000000..7b75c2d
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/library.xsd
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/cxx/hybrid/binary/custom/makefile b/examples/cxx/hybrid/binary/custom/makefile
new file mode 100644
index 0000000..7ab91d0
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/makefile
@@ -0,0 +1,138 @@
+# file : examples/cxx/hybrid/binary/custom/makefile
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
+
+xsd := library.xsd
+cxx := driver.cxx exceptions.cxx orawstream.cxx irawstream.cxx
+
+obj := $(addprefix $(out_base)/,\
+$(cxx:.cxx=.o) \
+$(xsd:.xsd=.o) \
+$(xsd:.xsd=-pskel.o) \
+$(xsd:.xsd=-pimpl.o) \
+$(xsd:.xsd=-sskel.o) \
+$(xsd:.xsd=-simpl.o))
+
+dep := $(obj:.o=.o.d)
+
+xsde.l := $(out_root)/libxsde/xsde/xsde.l
+xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options
+
+driver := $(out_base)/driver
+dist := $(out_base)/.dist
+dist-win := $(out_base)/.dist-win
+clean := $(out_base)/.clean
+
+# Build.
+#
+$(driver): $(obj) $(xsde.l)
+
+$(obj) $(dep): $(xsde.l.cpp-options)
+
+genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.cxx) \
+ $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.cxx) \
+ $(xsd:.xsd=-pimpl.hxx) $(xsd:.xsd=-pimpl.cxx) \
+ $(xsd:.xsd=-sskel.hxx) $(xsd:.xsd=-sskel.cxx) \
+ $(xsd:.xsd=-simpl.hxx) $(xsd:.xsd=-simpl.cxx)
+
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(out_root)/xsde/xsde
+$(gen): xsde := $(out_root)/xsde/xsde
+$(gen): xsde_options += --generate-parser --generate-serializer \
+--generate-aggregate --extern-xml-schema xml-schema.xsd \
+--generate-insertion orawstream --hxx-prologue '\\\#include "orawstream.hxx"' \
+--generate-extraction irawstream --hxx-prologue '\\\#include "irawstream.hxx"'
+
+# Header files for XML Schema namespace.
+#
+$(out_base)/xml-schema%hxx \
+$(out_base)/xml-schema-pskel%hxx \
+$(out_base)/xml-schema-sskel%hxx: $(out_root)/xsde/xsde
+ $(call message,xsde $(src_base)/xml-schema.xsd,\
+$(out_root)/xsde/xsde cxx-hybrid --output-dir $(out_base) \
+--generate-xml-schema --generate-parser --generate-serializer xml-schema.xsd)
+
+genf += xml-schema.hxx xml-schema-pskel.hxx xml-schema-sskel.hxx
+
+$(call include-dep,$(dep))
+
+# Convenience alias for default target.
+#
+.PHONY: $(out_base)/
+$(out_base)/: $(driver)
+
+
+# Dist.
+#
+dist-common := $(out_base)/.dist-common
+
+.PHONY: $(dist) $(dist-win) $(dist-common)
+
+$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base))
+
+$(dist-common):
+ $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx)
+ $(call install-data,$(src_base)/exceptions.cxx,$(dist_prefix)/$(path)/exceptions.cxx)
+ $(call install-data,$(src_base)/exceptions.hxx,$(dist_prefix)/$(path)/exceptions.hxx)
+ $(call install-data,$(src_base)/orawstream.hxx,$(dist_prefix)/$(path)/orawstream.hxx)
+ $(call install-data,$(src_base)/orawstream.ixx,$(dist_prefix)/$(path)/orawstream.ixx)
+ $(call install-data,$(src_base)/orawstream.txx,$(dist_prefix)/$(path)/orawstream.txx)
+ $(call install-data,$(src_base)/orawstream.cxx,$(dist_prefix)/$(path)/orawstream.cxx)
+ $(call install-data,$(src_base)/irawstream.hxx,$(dist_prefix)/$(path)/irawstream.hxx)
+ $(call install-data,$(src_base)/irawstream.ixx,$(dist_prefix)/$(path)/irawstream.ixx)
+ $(call install-data,$(src_base)/irawstream.txx,$(dist_prefix)/$(path)/irawstream.txx)
+ $(call install-data,$(src_base)/irawstream.cxx,$(dist_prefix)/$(path)/irawstream.cxx)
+ $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd)
+ $(call install-data,$(src_base)/library.xml,$(dist_prefix)/$(path)/library.xml)
+
+$(dist): $(dist-common)
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README)
+
+$(dist-win): $(dist-common)
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt)
+ $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt)
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(obj)) \
+ $(addsuffix .cxx.clean,$(dep)) \
+ $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean))
+ $(call message,rm $$1,rm -f $$1,$(out_base)/xml-schema.hxx)
+ $(call message,rm $$1,rm -f $$1,$(out_base)/xml-schema-pskel.hxx)
+ $(call message,rm $$1,rm -f $$1,$(out_base)/xml-schema-sskel.hxx)
+
+
+# Generated .gitignore.
+#
+ifeq ($(out_base),$(src_base))
+$(gen): | $(out_base)/.gitignore
+$(driver): | $(out_base)/.gitignore
+
+$(out_base)/.gitignore: files := driver $(genf)
+$(clean): $(out_base)/.gitignore.clean
+
+$(call include,$(bld_root)/git/gitignore.make)
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-e.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/install.make)
+$(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make)
+
+
+# Dependencies.
+#
+$(call import,$(src_root)/xsde/makefile)
+$(call import,$(src_root)/libxsde/xsde/makefile)
diff --git a/examples/cxx/hybrid/binary/custom/orawstream.cxx b/examples/cxx/hybrid/binary/custom/orawstream.cxx
new file mode 100644
index 0000000..dc4b477
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/orawstream.cxx
@@ -0,0 +1,224 @@
+// file : examples/cxx/hybrid/binary/custom/orawstream.cxx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#include // memcpy
+
+#include "orawstream.hxx"
+
+using namespace xml_schema;
+
+char* orawstream::
+align (size_t a, size_t n)
+{
+ size_t s = buf_.size ();
+ size_t c = buf_.capacity ();
+ size_t r = s % a;
+
+ if (r)
+ n += a - r;
+
+ if (c - s < n)
+ {
+ // Do exponential growth.
+ //
+ size_t nc = s + n;
+ c *= 2;
+
+ if (nc < c)
+ nc = c;
+
+ buf_.capacity (nc);
+ }
+
+ char* p = buf_.data () + s;
+
+ if (r)
+ p += a - r;
+
+ buf_.size (s + n);
+ return p;
+}
+
+void orawstream::
+operator<< (const std::string& x)
+{
+ size_t n = x.length ();
+ char* p = align (sizeof (size_t), sizeof (size_t) + n);
+
+ *reinterpret_cast (p) = n;
+ p += sizeof (size_t);
+ memcpy (p, x.c_str (), n);
+}
+
+void orawstream::
+operator<< (const buffer& x)
+{
+ size_t n = x.size ();
+ char* p = align (sizeof (size_t), sizeof (size_t) + n);
+
+ *reinterpret_cast (p) = n;
+ p += sizeof (size_t);
+ memcpy (p, x.data (), n);
+}
+
+void
+operator<< (orawstream& s, const str_seq& x)
+{
+ s << orawstream::as_size (x.size ());
+
+ for (str_seq::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ s << *i;
+ }
+}
+
+void
+operator<< (orawstream& s, const qname& x)
+{
+ s << x.prefix ();
+ s << x.name ();
+}
+
+void
+operator<< (orawstream& s, const time_zone& x)
+{
+ s << x.zone_hours ();
+ s << x.zone_minutes ();
+}
+
+void
+operator<< (orawstream& s, const date& x)
+{
+ s << x.year ();
+ s << x.month ();
+ s << x.day ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
+
+void
+operator<< (orawstream& s, const date_time& x)
+{
+ s << x.year ();
+ s << x.month ();
+ s << x.day ();
+ s << x.hours ();
+ s << x.minutes ();
+ s << x.seconds ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
+
+void
+operator<< (orawstream& s, const duration& x)
+{
+ s << x.negative ();
+ s << x.years ();
+ s << x.months ();
+ s << x.days ();
+ s << x.hours ();
+ s << x.minutes ();
+ s << x.seconds ();
+}
+
+void
+operator<< (orawstream& s, const gday& x)
+{
+ s << x.day ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
+
+void
+operator<< (orawstream& s, const gmonth& x)
+{
+ s << x.month ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
+
+void
+operator<< (orawstream& s, const gmonth_day& x)
+{
+ s << x.month ();
+ s << x.day ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
+
+void
+operator<< (orawstream& s, const gyear& x)
+{
+ s << x.year ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
+
+void
+operator<< (orawstream& s, const gyear_month& x)
+{
+ s << x.year ();
+ s << x.month ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
+
+void
+operator<< (orawstream& s, const xml_schema::time& x)
+{
+ s << x.hours ();
+ s << x.minutes ();
+ s << x.seconds ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+}
diff --git a/examples/cxx/hybrid/binary/custom/orawstream.hxx b/examples/cxx/hybrid/binary/custom/orawstream.hxx
new file mode 100644
index 0000000..9689e61
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/orawstream.hxx
@@ -0,0 +1,91 @@
+// file : examples/cxx/hybrid/binary/custom/orawstream.hxx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#ifndef ORAWSTREAM_HXX
+#define ORAWSTREAM_HXX
+
+#include // size_t
+
+#include
+
+#include "exceptions.hxx"
+#include "xml-schema.hxx"
+
+class orawstream
+{
+public:
+ explicit
+ orawstream (xml_schema::buffer&);
+
+public:
+ struct as_size
+ {
+ explicit as_size (size_t s) : s_ (s) {}
+ size_t s_;
+ };
+
+public:
+ void operator<< (bool);
+ void operator<< (signed char);
+ void operator<< (unsigned char);
+ void operator<< (short);
+ void operator<< (unsigned short);
+ void operator<< (int);
+ void operator<< (unsigned int);
+ void operator<< (long);
+ void operator<< (unsigned long);
+
+#ifdef XSDE_LONGLONG
+ void operator<< (long long);
+ void operator<< (unsigned long long);
+#endif
+
+ void operator<< (as_size);
+ void operator<< (float);
+ void operator<< (double);
+
+ void operator<< (const std::string&);
+ void operator<< (const xml_schema::buffer&);
+
+private:
+ orawstream (const orawstream&);
+ orawstream& operator= (const orawstream&);
+
+public:
+ char*
+ align (size_t alignment, size_t size);
+
+private:
+ xml_schema::buffer& buf_;
+};
+
+void operator<< (orawstream&, const xml_schema::any_type&);
+void operator<< (orawstream&, const xml_schema::any_simple_type&);
+void operator<< (orawstream&, const xml_schema::qname&);
+void operator<< (orawstream&, const xml_schema::time_zone&);
+void operator<< (orawstream&, const xml_schema::date&);
+void operator<< (orawstream&, const xml_schema::date_time&);
+void operator<< (orawstream&, const xml_schema::duration&);
+void operator<< (orawstream&, const xml_schema::gday&);
+void operator<< (orawstream&, const xml_schema::gmonth&);
+void operator<< (orawstream&, const xml_schema::gmonth_day&);
+void operator<< (orawstream&, const xml_schema::gyear&);
+void operator<< (orawstream&, const xml_schema::gyear_month&);
+void operator<< (orawstream&, const xml_schema::time&);
+
+void operator<< (orawstream&, const xml_schema::str_seq&);
+
+template
+void operator<< (orawstream&, const xml_schema::pod_seq&);
+
+template
+void operator<< (orawstream&, const xml_schema::fix_seq&);
+
+template
+void operator<< (orawstream&, const xml_schema::var_seq&);
+
+#include "orawstream.ixx"
+#include "orawstream.txx"
+
+#endif // ORAWSTREAM_HXX
diff --git a/examples/cxx/hybrid/binary/custom/orawstream.ixx b/examples/cxx/hybrid/binary/custom/orawstream.ixx
new file mode 100644
index 0000000..577eb1b
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/orawstream.ixx
@@ -0,0 +1,110 @@
+// file : examples/cxx/hybrid/binary/custom/orawstream.ixx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+inline orawstream::
+orawstream (xml_schema::buffer& buf)
+ : buf_ (buf)
+{
+}
+
+inline void orawstream::
+operator<< (bool x)
+{
+ *align (1, 1) = x;
+}
+
+inline void orawstream::
+operator<< (signed char x)
+{
+ *reinterpret_cast (align (1, 1)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned char x)
+{
+ *reinterpret_cast (align (1, 1)) = x;
+}
+
+inline void orawstream::
+operator<< (short x)
+{
+ *reinterpret_cast (align (2, 2)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned short x)
+{
+ *reinterpret_cast (align (2, 2)) = x;
+}
+
+inline void orawstream::
+operator<< (int x)
+{
+ *reinterpret_cast (align (4, 4)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned int x)
+{
+ *reinterpret_cast (align (4, 4)) = x;
+}
+
+inline void orawstream::
+operator<< (long x)
+{
+ *reinterpret_cast (
+ align (sizeof (long), sizeof (long))) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned long x)
+{
+ *reinterpret_cast (
+ align (sizeof (unsigned long), sizeof (unsigned long))) = x;
+}
+
+#ifdef XSDE_LONGLONG
+inline void orawstream::
+operator<< (long long x)
+{
+ *reinterpret_cast (align (8, 8)) = x;
+}
+
+inline void orawstream::
+operator<< (unsigned long long x)
+{
+ *reinterpret_cast (align (8, 8)) = x;
+}
+#endif
+
+inline void orawstream::
+operator<< (as_size x)
+{
+ *reinterpret_cast (
+ align (sizeof (size_t), sizeof (size_t))) = x.s_;
+}
+
+inline void orawstream::
+operator<< (float x)
+{
+ *reinterpret_cast (
+ align (sizeof (float), sizeof (float))) = x;
+}
+
+inline void orawstream::
+operator<< (double x)
+{
+ *reinterpret_cast (
+ align (sizeof (double), sizeof (double))) = x;
+}
+
+inline void
+operator<< (orawstream&, const xml_schema::any_type&)
+{
+}
+
+inline void
+operator<< (orawstream&, const xml_schema::any_simple_type&)
+{
+}
diff --git a/examples/cxx/hybrid/binary/custom/orawstream.txx b/examples/cxx/hybrid/binary/custom/orawstream.txx
new file mode 100644
index 0000000..46c5b71
--- /dev/null
+++ b/examples/cxx/hybrid/binary/custom/orawstream.txx
@@ -0,0 +1,47 @@
+// file : examples/cxx/hybrid/binary/custom/orawostream.txx
+// author : Boris Kolpackov
+// copyright : not copyrighted - public domain
+
+#include // memcpy
+
+template
+void
+operator<< (orawstream& s, const xml_schema::pod_seq& x)
+{
+ size_t n = x.size ();
+
+ s << orawstream::as_size (x.size ());
+
+ if (n != 0)
+ {
+ size_t mn = sizeof (T) * n;
+ char* p = s.align (sizeof (T), mn);
+ memcpy (p, x.begin (), mn);
+ }
+}
+
+template
+void
+operator<< (orawstream& s, const xml_schema::fix_seq& x)
+{
+ s << orawstream::as_size (x.size ());
+
+ for (typename xml_schema::fix_seq::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ s << *i;
+ }
+}
+
+template
+void
+operator<< (orawstream& s, const xml_schema::var_seq& x)
+{
+ s << orawstream::as_size (x.size ());
+
+ for (typename xml_schema::var_seq::const_iterator i = x.begin ();
+ i != x.end (); ++i)
+ {
+ s << *i;
+ }
+}
diff --git a/examples/cxx/hybrid/binary/makefile b/examples/cxx/hybrid/binary/makefile
new file mode 100644
index 0000000..89fb738
--- /dev/null
+++ b/examples/cxx/hybrid/binary/makefile
@@ -0,0 +1,53 @@
+# file : examples/cxx/hybrid/binary/makefile
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
+
+all_examples := cdr xdr custom
+build_examples :=
+
+ifeq ($(xsde_iostream),y)
+ifeq ($(xsde_exceptions),y)
+
+build_examples += custom
+
+ifeq ($(xsde_cdr),y)
+build_examples += cdr
+endif
+
+ifeq ($(xsde_cdr),y)
+build_examples += xdr
+endif
+
+endif
+endif
+
+default := $(out_base)/
+dist := $(out_base)/.dist
+dist-win := $(out_base)/.dist-win
+clean := $(out_base)/.clean
+
+.PHONY: $(default) $(dist) $(dist-win) $(clean)
+
+$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_examples)))
+$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(build_examples)))
+
+# Dist.
+#
+$(dist) $(dist-win): path := $(subst $(src_root)/,,$(src_base))
+
+$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_examples)))
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README)
+
+$(dist-win): $(addprefix $(out_base)/,$(addsuffix /.dist-win,$(all_examples)))
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt)
+ $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt)
+
+
+ifneq ($(filter $(MAKECMDGOALS),dist dist-win),)
+$(foreach e,$(all_examples),$(call import,$(src_base)/$e/makefile))
+else
+$(foreach e,$(build_examples),$(call import,$(src_base)/$e/makefile))
+endif
diff --git a/examples/cxx/hybrid/binary/xdr/README b/examples/cxx/hybrid/binary/xdr/README
new file mode 100644
index 0000000..e81a149
--- /dev/null
+++ b/examples/cxx/hybrid/binary/xdr/README
@@ -0,0 +1,50 @@
+This example shows how to save/load the C++/Hybrid object model to/from
+XDR (eXternal Data Representation) binary format using XDR streams. The
+XDR API is available out of the box on most POSIX systems as part of Sun
+RPC. On other platforms you may need to install a third-party library
+which provides the XDR API.
+
+The example consists of the following files:
+
+library.xsd
+ XML Schema which describes a library of books.
+
+library.xml
+ Sample XML instance document.
+
+library.hxx
+library.cxx
+
+library-pskel.hxx
+library-pskel.cxx
+library-pimpl.hxx
+library-pimpl.cxx
+
+library-pskel.hxx
+library-pskel.cxx
+library-pimpl.hxx
+library-pimpl.cxx
+ Object model (the first pair of files), parser skeletons (the
+ second pair), parser implementations (the third pair), serializer
+ skeletons (the fourth pair), and serializer implementations (the
+ fifth pair). These files are generated by the XSD/e compiler from
+ library.xsd. The --generate-parser, --generate-serializer, and
+ --generate-aggregate options were used to request the generation
+ of the parsing and serialization code. The --generate-insertion and
+ --generate-extraction options were used to generate the insertion
+ and extraction operations for the XDR streams.
+
+driver.cxx
+ Driver for the example. It first calls the parser that constructs
+ the object model from the input XML file. It then saves the object
+ model to the XDR representation and loads it back. Finally, the
+ driver calls the serializer to serialize the loaded object model
+ back to XML.
+
+To run the example on the sample XML instance document simply execute:
+
+$ ./driver library.xml
+
+The example reads from STDIN if input file is not specified:
+
+$ ./driver
+// copyright : not copyrighted - public domain
+
+#include // size_t
+#include // memcpy
+#include
+
+#include // std::auto_ptr
+#include
+
+#include "library.hxx"
+
+#include "library-pimpl.hxx"
+#include "library-simpl.hxx"
+
+using std::cerr;
+using std::endl;
+
+// XDR output functions. Their implementations are provided after main().
+//
+struct underflow_info
+{
+ xml_schema::buffer* buf;
+ size_t pos;
+};
+
+extern "C" int
+overflow (void* user_data, char* buf, int n);
+
+extern "C" int
+underflow (void* user_data, char* buf, int n);
+
+// The xdrrec_create function (used below) has slightly different
+// prototypes on different platforms. To make this example portable
+// we will need to cast the actual function to the following common
+// prototype.
+//
+extern "C"
+typedef void (*xdrrec_create_p) (
+ XDR*,
+ unsigned int write_size,
+ unsigned int read_size,
+ void* user_data,
+ int (*read) (void* user_data, char* buf, int n),
+ int (*write) (void* user_data, char* buf, int n));
+
+int
+main (int argc, char* argv[])
+{
+ const char* input;
+
+ if (argc < 2)
+ {
+ input = "STDIN";
+ cerr << "XML file not specified, reading from STDIN" << endl;
+ }
+ else
+ input = argv[1];
+
+ try
+ {
+ using namespace library;
+
+ // Parse.
+ //
+ catalog_paggr catalog_p;
+
+ xml_schema::document_pimpl doc_p (
+ catalog_p.root_parser (),
+ catalog_p.root_namespace (),
+ catalog_p.root_name ());
+
+ catalog_p.pre ();
+
+ if (argc < 2)
+ doc_p.parse (std::cin);
+ else
+ doc_p.parse (argv[1]);
+
+ std::auto_ptr c (catalog_p.post ());
+
+ // Save the object model to an XDR stream.
+ //
+ xdrrec_create_p xdrrec_create_ =
+ reinterpret_cast (::xdrrec_create);
+
+ XDR xdr;
+ xml_schema::buffer buf;
+
+ xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&buf), 0, &overflow);
+ xdr.x_op = XDR_ENCODE;
+ xml_schema::oxdrstream oxdr (xdr);
+
+ oxdr << *c;
+
+ xdrrec_endofrecord (&xdr, true); // Flush the data.
+ xdr_destroy (&xdr);
+
+ // The binary representation is now in the memory buffer 'buf'.
+ // To get to the raw data use buf.data() and buf.size().
+ //
+ cerr << "binary representation size: " << buf.size () << endl
+ << endl;
+
+ // Load the object model from an XDR stream.
+ //
+ underflow_info ui;
+ ui.buf = &buf;
+ ui.pos = 0;
+
+ xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&ui), &underflow, 0);
+ xdr.x_op = XDR_DECODE;
+ xdrrec_skiprecord (&xdr);
+ xml_schema::ixdrstream ixdr (xdr);
+
+ std::auto_ptr copy (new catalog);
+ ixdr >> *copy;
+
+ xdr_destroy (&xdr);
+
+ // Serialize the copy back to XML.
+ //
+ catalog_saggr catalog_s;
+
+ xml_schema::document_simpl doc_s (
+ catalog_s.root_serializer (),
+ catalog_s.root_namespace (),
+ catalog_s.root_name ());
+
+ doc_s.add_prefix ("lib", "http://www.codesynthesis.com/library");
+ doc_s.add_schema ("http://www.codesynthesis.com/library", "library.xsd");
+
+ catalog_s.pre (*c);
+ doc_s.serialize (std::cout);
+ catalog_s.post ();
+ }
+ catch (const xml_schema::xdr_exception&)
+ {
+ cerr << "XDR operation failed" << endl;
+ return 1;
+ }
+ catch (const xml_schema::parser_exception& e)
+ {
+ cerr << input << ":" << e.line () << ":" << e.column () << ": "
+ << e.text () << endl;
+ return 1;
+ }
+ catch (const xml_schema::serializer_exception& e)
+ {
+ cerr << "error: " << e.text () << endl;
+ return 1;
+ }
+ catch (const std::ios_base::failure&)
+ {
+ cerr << input << ": unable to open or read/write failure" << endl;
+ return 1;
+ }
+
+ return 0;
+}
+
+extern "C" int
+overflow (void* p, char* buf, int n_)
+{
+ xml_schema::buffer* dst (reinterpret_cast (p));
+ size_t n (static_cast (n_));
+
+ size_t size (dst->size ());
+ size_t capacity (dst->capacity ());
+
+ // Implement exponential growth.
+ //
+ if (size + n > capacity && size + n < capacity * 2)
+ dst->capacity (capacity * 2);
+
+ dst->size (size + n);
+ memcpy (dst->data () + size, buf, n);
+
+ return n;
+}
+
+extern "C" int
+underflow (void* p, char* buf, int n_)
+{
+ underflow_info* ui (reinterpret_cast (p));
+ size_t n (static_cast (n_));
+
+ size_t size (ui->buf->size () - ui->pos);
+ n = size > n ? n : size;
+
+ memcpy (buf, ui->buf->data () + ui->pos, n);
+ ui->pos += n;
+
+ return n;
+}
diff --git a/examples/cxx/hybrid/binary/xdr/library.xml b/examples/cxx/hybrid/binary/xdr/library.xml
new file mode 100644
index 0000000..ee5f771
--- /dev/null
+++ b/examples/cxx/hybrid/binary/xdr/library.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+ 0679760806
+ The Master and Margarita
+ fiction
+
+
+ Mikhail Bulgakov
+ 1891-05-15
+ 1940-03-10
+
+
+
+
+
+ 0679600841
+ War and Peace
+ history
+
+
+ Leo Tolstoy
+ 1828-09-09
+ 1910-11-20
+
+
+
+
+
+ 0679420290
+ Crime and Punishment
+ philosophy
+
+
+ Fyodor Dostoevsky
+ 1821-11-11
+ 1881-02-09
+
+
+
+
diff --git a/examples/cxx/hybrid/binary/xdr/library.xsd b/examples/cxx/hybrid/binary/xdr/library.xsd
new file mode 100644
index 0000000..5e411d9
--- /dev/null
+++ b/examples/cxx/hybrid/binary/xdr/library.xsd
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/cxx/hybrid/binary/xdr/makefile b/examples/cxx/hybrid/binary/xdr/makefile
new file mode 100644
index 0000000..0cff972
--- /dev/null
+++ b/examples/cxx/hybrid/binary/xdr/makefile
@@ -0,0 +1,112 @@
+# file : examples/cxx/hybrid/binary/xdr/makefile
+# author : Boris Kolpackov
+# copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
+
+xsd := library.xsd
+cxx := driver.cxx
+
+obj := $(addprefix $(out_base)/,\
+$(cxx:.cxx=.o) \
+$(xsd:.xsd=.o) \
+$(xsd:.xsd=-pskel.o) \
+$(xsd:.xsd=-pimpl.o) \
+$(xsd:.xsd=-sskel.o) \
+$(xsd:.xsd=-simpl.o))
+
+dep := $(obj:.o=.o.d)
+
+xsde.l := $(out_root)/libxsde/xsde/xsde.l
+xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options
+
+driver := $(out_base)/driver
+dist := $(out_base)/.dist
+dist-win := $(out_base)/.dist-win
+clean := $(out_base)/.clean
+
+# Build.
+#
+$(driver): $(obj) $(xsde.l)
+
+$(obj) $(dep): $(xsde.l.cpp-options)
+
+genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.cxx) \
+ $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.cxx) \
+ $(xsd:.xsd=-pimpl.hxx) $(xsd:.xsd=-pimpl.cxx) \
+ $(xsd:.xsd=-sskel.hxx) $(xsd:.xsd=-sskel.cxx) \
+ $(xsd:.xsd=-simpl.hxx) $(xsd:.xsd=-simpl.cxx)
+
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(out_root)/xsde/xsde
+$(gen): xsde := $(out_root)/xsde/xsde
+$(gen): xsde_options += --generate-parser --generate-serializer \
+--generate-aggregate --generate-insertion XDR --generate-extraction XDR
+
+$(call include-dep,$(dep))
+
+# Convenience alias for default target.
+#
+.PHONY: $(out_base)/
+$(out_base)/: $(driver)
+
+
+# Dist.
+#
+dist-common := $(out_base)/.dist-common
+
+.PHONY: $(dist) $(dist-win) $(dist-common)
+
+$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base))
+
+$(dist-common):
+ $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx)
+ $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd)
+ $(call install-data,$(src_base)/library.xml,$(dist_prefix)/$(path)/library.xml)
+
+$(dist): $(dist-common)
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README)
+
+$(dist-win): $(dist-common)
+ $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt)
+ $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt)
+
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(obj)) \
+ $(addsuffix .cxx.clean,$(dep)) \
+ $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean))
+
+
+# Generated .gitignore.
+#
+ifeq ($(out_base),$(src_base))
+$(gen): | $(out_base)/.gitignore
+$(driver): | $(out_base)/.gitignore
+
+$(out_base)/.gitignore: files := driver $(genf)
+$(clean): $(out_base)/.gitignore.clean
+
+$(call include,$(bld_root)/git/gitignore.make)
+endif
+
+
+# How to.
+#
+$(call include,$(bld_root)/cxx/o-e.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/install.make)
+$(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make)
+
+
+# Dependencies.
+#
+$(call import,$(src_root)/xsde/makefile)
+$(call import,$(src_root)/libxsde/xsde/makefile)
diff --git a/examples/cxx/hybrid/makefile b/examples/cxx/hybrid/makefile
index 765c196..06a0ffa 100644
--- a/examples/cxx/hybrid/makefile
+++ b/examples/cxx/hybrid/makefile
@@ -5,10 +5,10 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
-all_examples := compositors hello multiroot streaming library wildcard \
-filter minimal
+all_examples := binary compositors hello multiroot streaming library \
+wildcard filter minimal
-build_examples := compositors
+build_examples := binary compositors
ifeq ($(xsde_iostream),y)
ifeq ($(xsde_exceptions),y)
diff --git a/libxsde/xsde/cxx/hybrid/cdr/date-time.cxx b/libxsde/xsde/cxx/hybrid/cdr/date-time.cxx
new file mode 100644
index 0000000..4feaa44
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/date-time.cxx
@@ -0,0 +1,764 @@
+// file : xsde/cxx/hybrid/cdr/date-time.cxx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include
+#include
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+#ifdef XSDE_EXCEPTIONS
+
+ // operator<<
+ //
+
+ void
+ operator<< (ocdrstream& s, const time_zone& x)
+ {
+ s << x.zone_hours ();
+ s << x.zone_minutes ();
+ }
+
+ void
+ operator<< (ocdrstream& s, const date& x)
+ {
+ s << x.year ();
+ s << x.month ();
+ s << x.day ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+ void
+ operator<< (ocdrstream& s, const date_time& x)
+ {
+ s << x.year ();
+ s << x.month ();
+ s << x.day ();
+ s << x.hours ();
+ s << x.minutes ();
+ s << x.seconds ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+ void
+ operator<< (ocdrstream& s, const duration& x)
+ {
+ s << x.negative ();
+ s << x.years ();
+ s << x.months ();
+ s << x.days ();
+ s << x.hours ();
+ s << x.minutes ();
+ s << x.seconds ();
+ }
+
+ void
+ operator<< (ocdrstream& s, const gday& x)
+ {
+ s << x.day ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+ void
+ operator<< (ocdrstream& s, const gmonth& x)
+ {
+ s << x.month ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+ void
+ operator<< (ocdrstream& s, const gmonth_day& x)
+ {
+ s << x.month ();
+ s << x.day ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+ void
+ operator<< (ocdrstream& s, const gyear& x)
+ {
+ s << x.year ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+ void
+ operator<< (ocdrstream& s, const gyear_month& x)
+ {
+ s << x.year ();
+ s << x.month ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+ void
+ operator<< (ocdrstream& s, const time& x)
+ {
+ s << x.hours ();
+ s << x.minutes ();
+ s << x.seconds ();
+ bool zp = x.zone_present ();
+ s << zp;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ s << z;
+ }
+ }
+
+
+ // operator>>
+ //
+
+ void
+ operator>> (icdrstream& s, time_zone& x)
+ {
+ short h, m;
+ s >> h;
+ s >> m;
+
+ x.zone_hours (h);
+ x.zone_minutes (m);
+ }
+
+ void
+ operator>> (icdrstream& s, date& x)
+ {
+ int y;
+ unsigned short m, d;
+ bool zp;
+
+ s >> y;
+ s >> m;
+ s >> d;
+ s >> zp;
+
+ x.year (y);
+ x.month (m);
+ x.day (d);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+ void
+ operator>> (icdrstream& s, date_time& x)
+ {
+ int y;
+ unsigned short m, d, h, mi;
+ double se;
+ bool zp;
+
+ s >> y;
+ s >> m;
+ s >> d;
+ s >> h;
+ s >> mi;
+ s >> se;
+ s >> zp;
+
+ x.year (y);
+ x.month (m);
+ x.day (d);
+ x.hours (h);
+ x.minutes (mi);
+ x.seconds (se);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+ void
+ operator>> (icdrstream& s, duration& x)
+ {
+ bool n;
+ unsigned int y, m, d, h, mi;
+ double se;
+
+ s >> n;
+ s >> y;
+ s >> m;
+ s >> d;
+ s >> h;
+ s >> mi;
+ s >> se;
+
+ x.negative (n);
+ x.years (y);
+ x.months (m);
+ x.days (d);
+ x.hours (h);
+ x.minutes (mi);
+ x.seconds (se);
+ }
+
+ void
+ operator>> (icdrstream& s, gday& x)
+ {
+ unsigned short d;
+ bool zp;
+
+ s >> d;
+ s >> zp;
+
+ x.day (d);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+ void
+ operator>> (icdrstream& s, gmonth& x)
+ {
+ unsigned short m;
+ bool zp;
+
+ s >> m;
+ s >> zp;
+
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+ void
+ operator>> (icdrstream& s, gmonth_day& x)
+ {
+ unsigned short d, m;
+ bool zp;
+
+ s >> d;
+ s >> m;
+ s >> zp;
+
+ x.day (d);
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+ void
+ operator>> (icdrstream& s, gyear& x)
+ {
+ int y;
+ bool zp;
+
+ s >> y;
+ s >> zp;
+
+ x.year (y);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+ void
+ operator>> (icdrstream& s, gyear_month& x)
+ {
+ int y;
+ unsigned short m;
+ bool zp;
+
+ s >> y;
+ s >> m;
+ s >> zp;
+
+ x.year (y);
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+ void
+ operator>> (icdrstream& s, time& x)
+ {
+ unsigned short h, m;
+ double se;
+ bool zp;
+
+ s >> h;
+ s >> m;
+ s >> se;
+ s >> zp;
+
+ x.hours (h);
+ x.minutes (m);
+ x.seconds (se);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ s >> z;
+ }
+ }
+
+#else // XSDE_EXCEPTIONS
+
+ // operator<<
+ //
+
+ bool
+ operator<< (ocdrstream& s, const time_zone& x)
+ {
+ return s << x.zone_hours () && s << x.zone_minutes ();
+ }
+
+ bool
+ operator<< (ocdrstream& s, const date& x)
+ {
+ bool zp = x.zone_present ();
+
+ if (!(s << x.year ()) ||
+ !(s << x.month ()) ||
+ !(s << x.day ()) ||
+ !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator<< (ocdrstream& s, const date_time& x)
+ {
+ bool zp = x.zone_present ();
+
+ if (!(s << x.year ()) ||
+ !(s << x.month ()) ||
+ !(s << x.day ()) ||
+ !(s << x.hours ()) ||
+ !(s << x.minutes ()) ||
+ !(s << x.seconds ()) ||
+ !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator<< (ocdrstream& s, const duration& x)
+ {
+ return s << x.negative () &&
+ s << x.years () &&
+ s << x.months () &&
+ s << x.days () &&
+ s << x.hours () &&
+ s << x.minutes () &&
+ s << x.seconds ();
+ }
+
+ bool
+ operator<< (ocdrstream& s, const gday& x)
+ {
+ bool zp = x.zone_present ();
+
+
+ if (!(s << x.day ()) || !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator<< (ocdrstream& s, const gmonth& x)
+ {
+ bool zp = x.zone_present ();
+
+ if (!(s << x.month ()) || !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator<< (ocdrstream& s, const gmonth_day& x)
+ {
+ bool zp = x.zone_present ();
+
+ if (!(s << x.month ()) || !(s << x.day ()) || !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator<< (ocdrstream& s, const gyear& x)
+ {
+ bool zp = x.zone_present ();
+
+ if (!(s << x.year ()) || !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator<< (ocdrstream& s, const gyear_month& x)
+ {
+ bool zp = x.zone_present ();
+
+ if (!(s << x.year ()) || !(s << x.month ()) || !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator<< (ocdrstream& s, const time& x)
+ {
+ bool zp = x.zone_present ();
+
+ if (!(s << x.hours ()) ||
+ !(s << x.minutes ()) ||
+ !(s << x.seconds ()) ||
+ !(s << zp))
+ return false;
+
+ if (zp)
+ {
+ const time_zone& z = x;
+ return s << z;
+ }
+
+ return true;
+ }
+
+
+ // operator>>
+ //
+
+ bool
+ operator>> (icdrstream& s, time_zone& x)
+ {
+ short h, m;
+
+ if (!(s >> h) || !(s >> m))
+ return false;
+
+ x.zone_hours (h);
+ x.zone_minutes (m);
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, date& x)
+ {
+ int y;
+ unsigned short m, d;
+ bool zp;
+
+ if (!(s >> y) || !(s >> m) || !(s >> d) || !(s >> zp))
+ return false;
+
+ x.year (y);
+ x.month (m);
+ x.day (d);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, date_time& x)
+ {
+ int y;
+ unsigned short m, d, h, mi;
+ double se;
+ bool zp;
+
+ if (!(s >> y) || !(s >> m) || !(s >> d) ||
+ !(s >> h) || !(s >> mi) || !(s >> se) || !(s >> zp))
+ return false;
+
+ x.year (y);
+ x.month (m);
+ x.day (d);
+ x.hours (h);
+ x.minutes (mi);
+ x.seconds (se);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, duration& x)
+ {
+ bool n;
+ unsigned int y, m, d, h, mi;
+ double se;
+
+ if (!(s >> n) || !(s >> y) || !(s >> m) || !(s >> d) ||
+ !(s >> h) || !(s >> mi) || !(s >> se))
+ return false;
+
+ x.negative (n);
+ x.years (y);
+ x.months (m);
+ x.days (d);
+ x.hours (h);
+ x.minutes (mi);
+ x.seconds (se);
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, gday& x)
+ {
+ unsigned short d;
+ bool zp;
+
+ if (!(s >> d) || !(s >> zp))
+ return false;
+
+ x.day (d);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, gmonth& x)
+ {
+ unsigned short m;
+ bool zp;
+
+ if (!(s >> m) || !(s >> zp))
+ return false;
+
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, gmonth_day& x)
+ {
+ unsigned short d, m;
+ bool zp;
+
+ if (!(s >> d) || !(s >> m) || !(s >> zp))
+ return false;
+
+ x.day (d);
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, gyear& x)
+ {
+ int y;
+ bool zp;
+
+ if (!(s >> y) || !(s >> zp))
+ return false;
+
+ x.year (y);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, gyear_month& x)
+ {
+ int y;
+ unsigned short m;
+ bool zp;
+
+ if (!(s >> y) || !(s >> m) || !(s >> zp))
+ return false;
+
+ x.year (y);
+ x.month (m);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+ bool
+ operator>> (icdrstream& s, time& x)
+ {
+ unsigned short h, m;
+ double se;
+ bool zp;
+
+ if (!(s >> h) || !(s >> m) || !(s >> se) || !(s >> zp))
+ return false;
+
+ x.hours (h);
+ x.minutes (m);
+ x.seconds (se);
+
+ if (zp)
+ {
+ time_zone& z = x;
+ return s >> z;
+ }
+
+ return true;
+ }
+
+#endif // XSDE_EXCEPTIONS
+ }
+ }
+}
diff --git a/libxsde/xsde/cxx/hybrid/cdr/exceptions.cxx b/libxsde/xsde/cxx/hybrid/cdr/exceptions.cxx
new file mode 100644
index 0000000..8b79805
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/exceptions.cxx
@@ -0,0 +1,21 @@
+// file : xsde/cxx/hybrid/cdr/exceptions.cxx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+ const char* cdr_exception::
+ what () const throw ()
+ {
+ return "CDR stream operation failed";
+ }
+ }
+ }
+}
diff --git a/libxsde/xsde/cxx/hybrid/cdr/exceptions.hxx b/libxsde/xsde/cxx/hybrid/cdr/exceptions.hxx
new file mode 100644
index 0000000..bc0b861
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/exceptions.hxx
@@ -0,0 +1,26 @@
+// file : xsde/cxx/hybrid/cdr/exceptions.hxx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSDE_CXX_HYBRID_CDR_EXCEPTIONS_HXX
+#define XSDE_CXX_HYBRID_CDR_EXCEPTIONS_HXX
+
+#include
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+ struct cdr_exception: xsde::cxx::exception
+ {
+ virtual const char*
+ what () const throw ();
+ };
+ }
+ }
+}
+
+#endif // XSDE_CXX_HYBRID_CDR_EXCEPTIONS_HXX
diff --git a/libxsde/xsde/cxx/hybrid/cdr/istream.cxx b/libxsde/xsde/cxx/hybrid/cdr/istream.cxx
new file mode 100644
index 0000000..111e668
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/istream.cxx
@@ -0,0 +1,101 @@
+// file : xsde/cxx/hybrid/cdr/istream.cxx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+#ifdef XSDE_EXCEPTIONS
+
+#ifdef XSDE_STL
+ struct str_guard
+ {
+ str_guard (char* s) : s_ (s) {}
+ ~str_guard () {delete[] s_;}
+
+ private:
+ char* s_;
+ };
+
+ void icdrstream::
+ operator>> (std::string& x)
+ {
+ char* v;
+
+ if (!cdr_.read_string (v))
+ throw cdr_exception ();
+
+ str_guard g (v);
+ x = v;
+ }
+#else
+ void icdrstream::
+ operator>> (char*& x)
+ {
+ if (!cdr_.read_string (x))
+ throw cdr_exception ();
+ }
+#endif
+
+ void icdrstream::
+ operator>> (buffer& x)
+ {
+ ACE_CDR::ULong n;
+
+ if (!cdr_.read_ulong (n))
+ throw cdr_exception ();
+
+ x.size (n);
+
+ if (!cdr_.read_octet_array (
+ reinterpret_cast (x.data ()), n))
+ throw cdr_exception ();
+ }
+
+#else // XSDE_EXCEPTIONS
+
+#ifdef XSDE_STL
+ bool icdrstream::
+ operator>> (std::string& x)
+ {
+ char* v;
+
+ if (!cdr_.read_string (v))
+ return false;
+
+ x = v;
+ delete[] v;
+ return true;
+ }
+#else
+ bool icdrstream::
+ operator>> (char*& x)
+ {
+ return cdr_.read_string (x);
+ }
+#endif
+
+ bool icdrstream::
+ operator>> (buffer& x)
+ {
+ ACE_CDR::ULong n;
+
+ if (!cdr_.read_ulong (n))
+ return false;
+
+ x.size (n);
+ return cdr_.read_octet_array (
+ reinterpret_cast (x.data ()), n);
+ }
+
+#endif // XSDE_EXCEPTIONS
+
+ }
+ }
+}
diff --git a/libxsde/xsde/cxx/hybrid/cdr/istream.hxx b/libxsde/xsde/cxx/hybrid/cdr/istream.hxx
new file mode 100644
index 0000000..484010b
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/istream.hxx
@@ -0,0 +1,182 @@
+// file : xsde/cxx/hybrid/cdr/istream.hxx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSDE_CXX_HYBRID_CDR_ISTREAM_HXX
+#define XSDE_CXX_HYBRID_CDR_ISTREAM_HXX
+
+#include
+
+#include // size_t
+
+#ifdef XSDE_STL
+# include
+#endif
+
+#include
+
+#include
+#include
+
+#ifdef XSDE_STL
+# include
+# include
+#else
+# include
+# include
+#endif
+
+#include
+#include
+
+#ifdef XSDE_EXCEPTIONS
+# include
+#endif
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+ class icdrstream
+ {
+ public:
+ explicit
+ icdrstream (ACE_InputCDR& cdr);
+
+ ACE_InputCDR&
+ impl ();
+
+ public:
+ struct as_size
+ {
+ explicit as_size (size_t& s) : s_ (s) {}
+ size_t& s_;
+ };
+
+ public:
+#ifdef XSDE_EXCEPTIONS
+
+ void operator>> (bool&);
+ void operator>> (signed char&);
+ void operator>> (unsigned char&);
+ void operator>> (short&);
+ void operator>> (unsigned short&);
+ void operator>> (int&);
+ void operator>> (unsigned int&);
+ void operator>> (long&);
+ void operator>> (unsigned long&);
+
+#ifdef XSDE_LONGLONG
+ void operator>> (long long&);
+ void operator>> (unsigned long long&);
+#endif
+ void operator>> (as_size&);
+ void operator>> (float&);
+ void operator>> (double&);
+
+#ifdef XSDE_STL
+ void operator>> (std::string&);
+#else
+ void operator>> (char*&);
+#endif
+ void operator>> (buffer&);
+
+#else // XSDE_EXCEPTIONS
+
+ bool operator>> (bool&);
+ bool operator>> (signed char&);
+ bool operator>> (unsigned char&);
+ bool operator>> (short&);
+ bool operator>> (unsigned short&);
+ bool operator>> (int&);
+ bool operator>> (unsigned int&);
+ bool operator>> (long&);
+ bool operator>> (unsigned long&);
+
+#ifdef XSDE_LONGLONG
+ bool operator>> (long long&);
+ bool operator>> (unsigned long long&);
+#endif
+ bool operator>> (as_size&);
+ bool operator>> (float&);
+ bool operator>> (double&);
+
+#ifdef XSDE_STL
+ bool operator>> (std::string&);
+#else
+ bool operator>> (char*&);
+#endif
+ bool operator>> (buffer&);
+
+#endif // XSDE_EXCEPTIONS
+
+ private:
+ icdrstream (const icdrstream&);
+ icdrstream& operator= (const icdrstream&);
+
+ private:
+ ACE_InputCDR& cdr_;
+ };
+
+#ifdef XSDE_EXCEPTIONS
+ void operator>> (icdrstream&, any_type&);
+ void operator>> (icdrstream&, any_simple_type&);
+ void operator>> (icdrstream&, qname&);
+ void operator>> (icdrstream&, string_sequence&);
+ void operator>> (icdrstream&, time_zone&);
+ void operator>> (icdrstream&, date&);
+ void operator>> (icdrstream&, date_time&);
+ void operator>> (icdrstream&, duration&);
+ void operator>> (icdrstream&, gday&);
+ void operator>> (icdrstream&, gmonth&);
+ void operator>> (icdrstream&, gmonth_day&);
+ void operator>> (icdrstream&, gyear&);
+ void operator>> (icdrstream&, gyear_month&);
+ void operator>> (icdrstream&, time&);
+#else
+ bool operator>> (icdrstream&, any_type&);
+ bool operator>> (icdrstream&, any_simple_type&);
+ bool operator>> (icdrstream&, qname&);
+ bool operator>> (icdrstream&, string_sequence&);
+ bool operator>> (icdrstream&, time_zone&);
+ bool operator>> (icdrstream&, date&);
+ bool operator>> (icdrstream&, date_time&);
+ bool operator>> (icdrstream&, duration&);
+ bool operator>> (icdrstream&, gday&);
+ bool operator>> (icdrstream&, gmonth&);
+ bool operator>> (icdrstream&, gmonth_day&);
+ bool operator>> (icdrstream&, gyear&);
+ bool operator>> (icdrstream&, gyear_month&);
+ bool operator>> (icdrstream&, time&);
+#endif
+
+#ifdef XSDE_EXCEPTIONS
+ template
+ void operator>> (icdrstream&, pod_seq&);
+
+ template
+ void operator>> (icdrstream&, fix_seq&);
+
+ template
+ void operator>> (icdrstream&, var_seq&);
+#else
+ template
+ bool operator>> (icdrstream&, pod_seq&);
+
+ template
+ bool operator>> (icdrstream&, fix_seq&);
+
+ template
+ bool operator>> (icdrstream&, var_seq&);
+#endif
+ }
+ }
+}
+
+#include
+#include
+
+#endif // XSDE_CXX_HYBRID_CDR_ISTREAM_HXX
diff --git a/libxsde/xsde/cxx/hybrid/cdr/istream.ixx b/libxsde/xsde/cxx/hybrid/cdr/istream.ixx
new file mode 100644
index 0000000..36d67dd
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/istream.ixx
@@ -0,0 +1,385 @@
+// file : xsde/cxx/hybrid/cdr/istream.ixx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+ inline icdrstream::
+ icdrstream (ACE_InputCDR& cdr)
+ : cdr_ (cdr)
+ {
+ }
+
+ inline ACE_InputCDR& icdrstream::
+ impl ()
+ {
+ return cdr_;
+ }
+
+#ifdef XSDE_EXCEPTIONS
+
+ inline void icdrstream::
+ operator>> (bool& x)
+ {
+ ACE_CDR::Boolean v;
+
+ if (!cdr_.read_boolean (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (signed char& x)
+ {
+ ACE_CDR::Octet v;
+
+ if (!cdr_.read_octet (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+
+ inline void icdrstream::
+ operator>> (unsigned char& x)
+ {
+ ACE_CDR::Octet v;
+
+ if (!cdr_.read_octet (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (short& x)
+ {
+ ACE_CDR::Short v;
+
+ if (!cdr_.read_short (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (unsigned short& x)
+ {
+ ACE_CDR::UShort v;
+
+ if (!cdr_.read_ushort (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (int& x)
+ {
+ ACE_CDR::Long v;
+
+ if (!cdr_.read_long (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (unsigned int& x)
+ {
+ ACE_CDR::ULong v;
+
+ if (!cdr_.read_ulong (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (long& x)
+ {
+ ACE_CDR::Long v;
+
+ if (!cdr_.read_long (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (unsigned long& x)
+ {
+ ACE_CDR::ULong v;
+
+ if (!cdr_.read_ulong (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+#ifdef XSDE_LONGLONG
+ inline void icdrstream::
+ operator>> (long long& x)
+ {
+ ACE_CDR::LongLong v;
+
+ if (!cdr_.read_longlong (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (unsigned long long& x)
+ {
+ ACE_CDR::ULongLong v;
+
+ if (!cdr_.read_ulonglong (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+#endif
+
+ inline void icdrstream::
+ operator>> (as_size& x)
+ {
+ // Assume size is 32-bit.
+ //
+ ACE_CDR::ULong v;
+
+ if (!cdr_.read_ulong (v))
+ throw cdr_exception ();
+
+ x.s_ = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (float& x)
+ {
+ ACE_CDR::Float v;
+
+ if (!cdr_.read_float (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void icdrstream::
+ operator>> (double& x)
+ {
+ ACE_CDR::Double v;
+
+ if (!cdr_.read_double (v))
+ throw cdr_exception ();
+
+ x = static_cast (v);
+ }
+
+ inline void
+ operator>> (icdrstream&, any_type&)
+ {
+ }
+
+ inline void
+ operator>> (icdrstream&, any_simple_type&)
+ {
+ }
+
+#else // XSDE_EXCEPTIONS
+
+ inline bool icdrstream::
+ operator>> (bool& x)
+ {
+ ACE_CDR::Boolean v;
+
+ if (!cdr_.read_boolean (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (signed char& x)
+ {
+ ACE_CDR::Octet v;
+
+ if (!cdr_.read_octet (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+
+ inline bool icdrstream::
+ operator>> (unsigned char& x)
+ {
+ ACE_CDR::Octet v;
+
+ if (!cdr_.read_octet (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (short& x)
+ {
+ ACE_CDR::Short v;
+
+ if (!cdr_.read_short (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (unsigned short& x)
+ {
+ ACE_CDR::UShort v;
+
+ if (!cdr_.read_ushort (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (int& x)
+ {
+ ACE_CDR::Long v;
+
+ if (!cdr_.read_long (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (unsigned int& x)
+ {
+ ACE_CDR::ULong v;
+
+ if (!cdr_.read_ulong (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (long& x)
+ {
+ ACE_CDR::Long v;
+
+ if (!cdr_.read_long (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (unsigned long& x)
+ {
+ ACE_CDR::ULong v;
+
+ if (!cdr_.read_ulong (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+#ifdef XSDE_LONGLONG
+ inline bool icdrstream::
+ operator>> (long long& x)
+ {
+ ACE_CDR::LongLong v;
+
+ if (!cdr_.read_longlong (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (unsigned long long& x)
+ {
+ ACE_CDR::ULongLong v;
+
+ if (!cdr_.read_ulonglong (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+#endif
+
+ inline bool icdrstream::
+ operator>> (as_size& x)
+ {
+ // Assume size is 32-bit.
+ //
+ ACE_CDR::ULong v;
+
+ if (!cdr_.read_ulong (v))
+ return false;
+
+ x.s_ = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (float& x)
+ {
+ ACE_CDR::Float v;
+
+ if (!cdr_.read_float (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool icdrstream::
+ operator>> (double& x)
+ {
+ ACE_CDR::Double v;
+
+ if (!cdr_.read_double (v))
+ return false;
+
+ x = static_cast (v);
+ return true;
+ }
+
+ inline bool
+ operator>> (icdrstream&, any_type&)
+ {
+ return true;
+ }
+
+ inline bool
+ operator>> (icdrstream&, any_simple_type&)
+ {
+ return true;
+ }
+
+#endif // XSDE_EXCEPTIONS
+ }
+ }
+}
diff --git a/libxsde/xsde/cxx/hybrid/cdr/istream.txx b/libxsde/xsde/cxx/hybrid/cdr/istream.txx
new file mode 100644
index 0000000..9afc5f5
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/istream.txx
@@ -0,0 +1,184 @@
+// file : xsde/cxx/hybrid/cdr/istream.txx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+#ifdef XSDE_EXCEPTIONS
+
+ template
+ void
+ operator>> (icdrstream& s, pod_seq& x)
+ {
+ size_t n;
+ icdrstream::as_size as_size (n);
+ s >> as_size;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ x.reserve (n);
+
+ T i;
+ while (n--)
+ {
+ s >> i;
+ x.push_back (i);
+ }
+ }
+ }
+
+ template
+ void
+ operator>> (icdrstream& s, fix_seq& x)
+ {
+ size_t n;
+ icdrstream::as_size as_size (n);
+ s >> as_size;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ x.reserve (n);
+
+ while (n--)
+ {
+ T i;
+ s >> i;
+ x.push_back (i);
+ }
+ }
+ }
+
+ template
+ void
+ operator>> (icdrstream& s, var_seq& x)
+ {
+ size_t n;
+ icdrstream::as_size as_size (n);
+ s >> as_size;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ x.reserve (n);
+
+ while (n--)
+ {
+ T* p = new T;
+ typename var_seq::guard g (p);
+ s >> *p;
+ g.release ();
+ x.push_back (p);
+ }
+ }
+ }
+
+#else // XSDE_EXCEPTIONS
+
+ template
+ bool
+ operator>> (icdrstream& s, pod_seq& x)
+ {
+ size_t n;
+ icdrstream::as_size as_size (n);
+
+ if (!(s >> as_size))
+ return false;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ if (x.reserve (n))
+ return false;
+
+ T i;
+ while (n--)
+ {
+ if (!(s >> i) || x.push_back (i))
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ template
+ bool
+ operator>> (icdrstream& s, fix_seq& x)
+ {
+ size_t n;
+ icdrstream::as_size as_size (n);
+
+ if (!(s >> as_size))
+ return false;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ if (x.reserve (n))
+ return false;
+
+ while (n--)
+ {
+ T i;
+ if (!(s >> i) || x.push_back (i))
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ template
+ bool
+ operator>> (icdrstream& s, var_seq& x)
+ {
+ size_t n;
+ icdrstream::as_size as_size (n);
+
+ if (!(s >> as_size))
+ return false;
+
+ x.clear ();
+
+ if (n > 0)
+ {
+ if (x.reserve (n))
+ return false;
+
+ while (n--)
+ {
+ T* p = new T;
+
+ if (p == 0)
+ return false;
+
+ if (!(s >> *p))
+ {
+ delete p;
+ return false;
+ }
+
+ if (x.push_back (p))
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+#endif // XSDE_EXCEPTIONS
+ }
+ }
+}
diff --git a/libxsde/xsde/cxx/hybrid/cdr/ostream.cxx b/libxsde/xsde/cxx/hybrid/cdr/ostream.cxx
new file mode 100644
index 0000000..e72e5fd
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/ostream.cxx
@@ -0,0 +1,88 @@
+// file : xsde/cxx/hybrid/cdr/ostream.cxx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include
+
+#ifndef XSDE_STL
+# include
+#endif
+
+#include
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+#ifdef XSDE_EXCEPTIONS
+
+ // CDR strings always use 32-bit length.
+ //
+#ifdef XSDE_STL
+ void ocdrstream::
+ operator<< (const std::string& x)
+ {
+ if (!cdr_.write_string (
+ static_cast (x.length ()), x.c_str ()))
+ throw cdr_exception ();
+ }
+#else
+ void ocdrstream::
+ operator<< (const char* x)
+ {
+ if (!cdr_.write_string (static_cast (strlen (x)), x))
+ throw cdr_exception ();
+ }
+#endif
+
+ void ocdrstream::
+ operator<< (const buffer& x)
+ {
+ // CDR arrays are limited to 32-bit size.
+ //
+ size_t n = x.size ();
+
+ if (!cdr_.write_ulong (static_cast (n)) ||
+ !cdr_.write_octet_array (
+ reinterpret_cast (x.data ()), n))
+ throw cdr_exception ();
+ }
+
+#else // XSDE_EXCEPTIONS
+
+#ifdef XSDE_STL
+ bool ocdrstream::
+ operator<< (const std::string& x)
+ {
+ return cdr_.write_string (
+ static_cast (x.length ()), x.c_str ());
+ }
+#else
+ bool ocdrstream::
+ operator<< (const char* x)
+ {
+ return cdr_.write_string (
+ static_cast (strlen (x)), x);
+ }
+#endif
+
+ bool ocdrstream::
+ operator<< (const buffer& x)
+ {
+ // CDR arrays are limited to 32-bit size.
+ //
+ size_t n = x.size ();
+
+ return cdr_.write_ulong (static_cast (n)) &&
+ cdr_.write_octet_array (
+ reinterpret_cast (x.data ()), n);
+ }
+
+#endif // XSDE_EXCEPTIONS
+
+ }
+ }
+}
diff --git a/libxsde/xsde/cxx/hybrid/cdr/ostream.hxx b/libxsde/xsde/cxx/hybrid/cdr/ostream.hxx
new file mode 100644
index 0000000..6b33fe0
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/ostream.hxx
@@ -0,0 +1,182 @@
+// file : xsde/cxx/hybrid/cdr/ostream.hxx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSDE_CXX_HYBRID_CDR_OSTREAM_HXX
+#define XSDE_CXX_HYBRID_CDR_OSTREAM_HXX
+
+#include
+
+#include // size_t
+
+#ifdef XSDE_STL
+# include
+#endif
+
+#include
+
+#include
+#include
+
+#ifdef XSDE_STL
+# include
+# include
+#else
+# include
+# include
+#endif
+
+#include
+#include
+
+#ifdef XSDE_EXCEPTIONS
+# include
+#endif
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+ class ocdrstream
+ {
+ public:
+ explicit
+ ocdrstream (ACE_OutputCDR& cdr);
+
+ ACE_OutputCDR&
+ impl ();
+
+ public:
+ struct as_size
+ {
+ explicit as_size (size_t s) : s_ (s) {}
+ size_t s_;
+ };
+
+ public:
+#ifdef XSDE_EXCEPTIONS
+
+ void operator<< (bool);
+ void operator<< (signed char);
+ void operator<< (unsigned char);
+ void operator<< (short);
+ void operator<< (unsigned short);
+ void operator<< (int);
+ void operator<< (unsigned int);
+ void operator<< (long);
+ void operator<< (unsigned long);
+
+#ifdef XSDE_LONGLONG
+ void operator<< (long long);
+ void operator<< (unsigned long long);
+#endif
+ void operator<< (as_size);
+ void operator<< (float);
+ void operator<< (double);
+
+#ifdef XSDE_STL
+ void operator<< (const std::string&);
+#else
+ void operator<< (const char*);
+#endif
+ void operator<< (const buffer&);
+
+#else // XSDE_EXCEPTIONS
+
+ bool operator<< (bool);
+ bool operator<< (signed char);
+ bool operator<< (unsigned char);
+ bool operator<< (short);
+ bool operator<< (unsigned short);
+ bool operator<< (int);
+ bool operator<< (unsigned int);
+ bool operator<< (long);
+ bool operator<< (unsigned long);
+
+#ifdef XSDE_LONGLONG
+ bool operator<< (long long);
+ bool operator<< (unsigned long long);
+#endif
+ bool operator<< (as_size);
+ bool operator<< (float);
+ bool operator<< (double);
+
+#ifdef XSDE_STL
+ bool operator<< (const std::string&);
+#else
+ bool operator<< (const char*);
+#endif
+ bool operator<< (const buffer&);
+
+#endif // XSDE_EXCEPTIONS
+
+ private:
+ ocdrstream (const ocdrstream&);
+ ocdrstream& operator= (const ocdrstream&);
+
+ private:
+ ACE_OutputCDR& cdr_;
+ };
+
+#ifdef XSDE_EXCEPTIONS
+ void operator<< (ocdrstream&, const any_type&);
+ void operator<< (ocdrstream&, const any_simple_type&);
+ void operator<< (ocdrstream&, const qname&);
+ void operator<< (ocdrstream&, const string_sequence&);
+ void operator<< (ocdrstream&, const time_zone&);
+ void operator<< (ocdrstream&, const date&);
+ void operator<< (ocdrstream&, const date_time&);
+ void operator<< (ocdrstream&, const duration&);
+ void operator<< (ocdrstream&, const gday&);
+ void operator<< (ocdrstream&, const gmonth&);
+ void operator<< (ocdrstream&, const gmonth_day&);
+ void operator<< (ocdrstream&, const gyear&);
+ void operator<< (ocdrstream&, const gyear_month&);
+ void operator<< (ocdrstream&, const time&);
+#else
+ bool operator<< (ocdrstream&, const any_type&);
+ bool operator<< (ocdrstream&, const any_simple_type&);
+ bool operator<< (ocdrstream&, const qname&);
+ bool operator<< (ocdrstream&, const string_sequence&);
+ bool operator<< (ocdrstream&, const time_zone&);
+ bool operator<< (ocdrstream&, const date&);
+ bool operator<< (ocdrstream&, const date_time&);
+ bool operator<< (ocdrstream&, const duration&);
+ bool operator<< (ocdrstream&, const gday&);
+ bool operator<< (ocdrstream&, const gmonth&);
+ bool operator<< (ocdrstream&, const gmonth_day&);
+ bool operator<< (ocdrstream&, const gyear&);
+ bool operator<< (ocdrstream&, const gyear_month&);
+ bool operator<< (ocdrstream&, const time&);
+#endif
+
+#ifdef XSDE_EXCEPTIONS
+ template
+ void operator<< (ocdrstream&, const pod_seq&);
+
+ template
+ void operator<< (ocdrstream&, const fix_seq&);
+
+ template
+ void operator<< (ocdrstream&, const var_seq&);
+#else
+ template
+ bool operator<< (ocdrstream&, const pod_seq&);
+
+ template
+ bool operator<< (ocdrstream&, const fix_seq&);
+
+ template
+ bool operator<< (ocdrstream&, const var_seq&);
+#endif
+ }
+ }
+}
+
+#include
+#include
+
+#endif // XSDE_CXX_HYBRID_CDR_OSTREAM_HXX
diff --git a/libxsde/xsde/cxx/hybrid/cdr/ostream.ixx b/libxsde/xsde/cxx/hybrid/cdr/ostream.ixx
new file mode 100644
index 0000000..272c5dd
--- /dev/null
+++ b/libxsde/xsde/cxx/hybrid/cdr/ostream.ixx
@@ -0,0 +1,245 @@
+// file : xsde/cxx/hybrid/cdr/ostream.ixx
+// author : Boris Kolpackov
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace hybrid
+ {
+ inline ocdrstream::
+ ocdrstream (ACE_OutputCDR& cdr)
+ : cdr_ (cdr)
+ {
+ }
+
+ inline ACE_OutputCDR& ocdrstream::
+ impl ()
+ {
+ return cdr_;
+ }
+
+#ifdef XSDE_EXCEPTIONS
+
+ inline void ocdrstream::
+ operator<< (bool x)
+ {
+ if (!cdr_.write_boolean (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (signed char x)
+ {
+ if (!cdr_.write_octet (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+
+ inline void ocdrstream::
+ operator<< (unsigned char x)
+ {
+ if (!cdr_.write_octet (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (short x)
+ {
+ if (!cdr_.write_short (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (unsigned short x)
+ {
+ if (!cdr_.write_ushort (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (int x)
+ {
+ if (!cdr_.write_long (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (unsigned int x)
+ {
+ if (!cdr_.write_ulong (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (long x)
+ {
+ if (!cdr_.write_long (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (unsigned long x)
+ {
+ if (!cdr_.write_ulong (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+#ifdef XSDE_LONGLONG
+ inline void ocdrstream::
+ operator<< (long long x)
+ {
+ if (!cdr_.write_longlong (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (unsigned long long x)
+ {
+ if (!cdr_.write_ulonglong (static_cast (x)))
+ throw cdr_exception ();
+ }
+#endif
+
+ inline void ocdrstream::
+ operator<< (as_size x)
+ {
+ // Assume size is 32-bit.
+ //
+ if (!cdr_.write_ulong (static_cast (x.s_)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (float x)
+ {
+ if (!cdr_.write_float (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void ocdrstream::
+ operator<< (double x)
+ {
+ if (!cdr_.write_double (static_cast (x)))
+ throw cdr_exception ();
+ }
+
+ inline void
+ operator<< (ocdrstream&, const any_type&)
+ {
+ }
+
+ inline void
+ operator<< (ocdrstream&, const any_simple_type&)
+ {
+ }
+
+#else // XSDE_EXCEPTIONS
+
+ inline bool ocdrstream::
+ operator<< (bool x)
+ {
+ return cdr_.write_boolean (static_cast (x));
+ }
+
+ inline bool ocdrstream::
+ operator<< (signed char x)
+ {
+ return cdr_.write_octet (static_cast (x));
+ }
+
+
+ inline bool ocdrstream::
+ operator<< (unsigned char x)
+ {
+ return cdr_.write_octet (static_cast (x));
+ }
+
+ inline bool ocdrstream::
+ operator<< (short x)
+ {
+ return cdr_.write_short (static_cast (x));
+ }
+
+ inline bool ocdrstream::
+ operator<< (unsigned short x)
+ {
+ return cdr_.write_ushort (static_cast (x));
+ }
+
+ inline bool ocdrstream::
+ operator<< (int x)
+ {
+ return cdr_.write_long (static_cast (x));
+ }
+
+ inline bool ocdrstream::
+ operator<< (unsigned int x)
+ {
+ return cdr_.write_ulong (static_cast (x));
+ }
+
+ inline bool ocdrstream::
+ operator<< (long x)
+ {
+ return cdr_.write_long (static_cast