From 56043225000df52cf530a85dc5f53ad06ba241cd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Oct 2009 08:52:20 +0200 Subject: Add support for STL-conforming iterators The new XSDE_STL_ITERATOR configuration variable is used to conditionally turn this on. --- build/configuration.make | 2 + build/configure | 8 ++++ dist/config/config.make | 24 +++++++---- dist/config/config.nmake | 24 +++++++---- dist/etc/evc-4.0/config.nmake | 24 +++++++---- dist/etc/iphone/config-device.make | 24 +++++++---- dist/etc/iphone/config-simulator.make | 24 +++++++---- dist/etc/lynxos/config-4.2.make | 24 +++++++---- dist/etc/lynxos/config-5.0.make | 24 +++++++---- dist/etc/qnx/config-6.3-gcc-2.95.make | 24 +++++++---- dist/etc/qnx/config-6.3-gcc-3.3.make | 24 +++++++---- dist/etc/qnx/config-6.4.make | 24 +++++++---- dist/etc/vc-8.0/config-max.nmake | 24 +++++++---- dist/etc/vc-8.0/config-min.nmake | 24 +++++++---- dist/etc/vc-9.0/config-max.nmake | 24 +++++++---- dist/etc/vc-9.0/config-min.nmake | 24 +++++++---- dist/etc/vxworks/config-5.5.1.make | 24 +++++++---- dist/etc/vxworks/config-6.4-max.make | 24 +++++++---- dist/etc/vxworks/config-6.4-min.make | 24 +++++++---- dist/etc/vxworks/config-6.7-max.make | 24 +++++++---- dist/etc/vxworks/config-6.7-min.make | 24 +++++++---- dist/libxsde/xsde/makefile | 3 ++ dist/libxsde/xsde/nmakefile | 3 ++ libxsde/xsde/cxx/hybrid/sequence.hxx | 15 ++++++- libxsde/xsde/makefile | 5 +++ tests/cxx/hybrid/iterator/driver.cxx | 62 +++++++++++++++++++++++++++ tests/cxx/hybrid/iterator/makefile | 80 +++++++++++++++++++++++++++++++++++ tests/cxx/hybrid/iterator/test.xsd | 24 +++++++++++ tests/cxx/hybrid/makefile | 8 +++- 29 files changed, 512 insertions(+), 154 deletions(-) create mode 100644 tests/cxx/hybrid/iterator/driver.cxx create mode 100644 tests/cxx/hybrid/iterator/makefile create mode 100644 tests/cxx/hybrid/iterator/test.xsd diff --git a/build/configuration.make b/build/configuration.make index bb7b932..96e6073 100644 --- a/build/configuration.make +++ b/build/configuration.make @@ -11,6 +11,7 @@ $(call include-once,$(scf_root)/configuration-rules.make,$(dcf_root)) xsde_arch_width := xsde_byteorder := xsde_stl := +xsde_stl_iterator := xsde_iostream := xsde_exceptions := xsde_longlong := @@ -35,6 +36,7 @@ ifdef xsde_stl $(out_root)/%: xsde_arch_width := $(xsde_arch_width) $(out_root)/%: xsde_byteorder := $(xsde_byteorder) $(out_root)/%: xsde_stl := $(xsde_stl) +$(out_root)/%: xsde_stl_iterator := $(xsde_stl_iterator) $(out_root)/%: xsde_iostream := $(xsde_iostream) $(out_root)/%: xsde_exceptions := $(xsde_exceptions) $(out_root)/%: xsde_longlong := $(xsde_longlong) diff --git a/build/configure b/build/configure index 16bccff..cdf1790 100755 --- a/build/configure +++ b/build/configure @@ -45,6 +45,13 @@ $echo stl=`read_y_n y` $echo +$echo "Would you like the generated code and runtime to provide STL-" +$echo "conforming iterators?" +$echo + +stl_iter=`read_y_n y` + +$echo $echo "Would you like the generated code and runtime to use IO streams?" $echo @@ -160,6 +167,7 @@ fi echo "xsde_arch_width := $arch_width" >$1 echo "xsde_byteorder := $byteorder" >>$1 echo "xsde_stl := $stl" >>$1 +echo "xsde_stl_iterator := $stl_iter" >>$1 echo "xsde_iostream := $iostream" >>$1 echo "xsde_exceptions := $exceptions" >>$1 echo "xsde_longlong := $longlong" >>$1 diff --git a/dist/config/config.make b/dist/config/config.make index e0eb217..ac3518c 100644 --- a/dist/config/config.make +++ b/dist/config/config.make @@ -29,47 +29,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := y # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := y +XSDE_SNPRINTF := y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/config/config.nmake b/dist/config/config.nmake index d09bb07..599d660 100644 --- a/dist/config/config.nmake +++ b/dist/config/config.nmake @@ -28,47 +28,55 @@ XSDFLAGS = --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM = win32 +XSDE_PLATFORM = win32 # Platform architecture width in bits. # -XSDE_ARCH_WIDTH = 32 +XSDE_ARCH_WIDTH = 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER = l +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 +XSDE_STL = y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR = y # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM = y +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 +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 +XSDE_LONGLONG = n # Set to 'n' if your platform doesn't have the _snprintf function. # -XSDE_SNPRINTF = y +XSDE_SNPRINTF = y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/evc-4.0/config.nmake b/dist/etc/evc-4.0/config.nmake index 9afda7a..cb4777f 100644 --- a/dist/etc/evc-4.0/config.nmake +++ b/dist/etc/evc-4.0/config.nmake @@ -31,47 +31,55 @@ XSDFLAGS = --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM = wince +XSDE_PLATFORM = wince # Platform architecture width in bits. # -XSDE_ARCH_WIDTH = 32 +XSDE_ARCH_WIDTH = 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER = l +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 +XSDE_STL = n + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR = n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM = n +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 +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 +XSDE_LONGLONG = n # Set to 'n' if your platform doesn't have the _snprintf function. # -XSDE_SNPRINTF = n +XSDE_SNPRINTF = n # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/iphone/config-device.make b/dist/etc/iphone/config-device.make index 2bd5f80..a52c484 100644 --- a/dist/etc/iphone/config-device.make +++ b/dist/etc/iphone/config-device.make @@ -36,47 +36,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := y # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := y +XSDE_SNPRINTF := y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/iphone/config-simulator.make b/dist/etc/iphone/config-simulator.make index eb989a4..3ab24df 100644 --- a/dist/etc/iphone/config-simulator.make +++ b/dist/etc/iphone/config-simulator.make @@ -36,47 +36,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := y # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := y +XSDE_SNPRINTF := y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/lynxos/config-4.2.make b/dist/etc/lynxos/config-4.2.make index 3dd3c5b..beb401e 100644 --- a/dist/etc/lynxos/config-4.2.make +++ b/dist/etc/lynxos/config-4.2.make @@ -35,47 +35,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := n +XSDE_SNPRINTF := n # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/lynxos/config-5.0.make b/dist/etc/lynxos/config-5.0.make index 0aaa569..3c64855 100644 --- a/dist/etc/lynxos/config-5.0.make +++ b/dist/etc/lynxos/config-5.0.make @@ -35,47 +35,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := n +XSDE_SNPRINTF := n # Set to 'n' if you don't want support for XML Schema validation in 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 bbacd4c..4a6bb1b 100644 --- a/dist/etc/qnx/config-6.3-gcc-2.95.make +++ b/dist/etc/qnx/config-6.3-gcc-2.95.make @@ -34,47 +34,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := n + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := n +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := y +XSDE_SNPRINTF := y # Set to 'n' if you don't want support for XML Schema validation in 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 a1fb72a..770693b 100644 --- a/dist/etc/qnx/config-6.3-gcc-3.3.make +++ b/dist/etc/qnx/config-6.3-gcc-3.3.make @@ -34,47 +34,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := y +XSDE_SNPRINTF := y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/qnx/config-6.4.make b/dist/etc/qnx/config-6.4.make index 4c850f8..a302d0d 100644 --- a/dist/etc/qnx/config-6.4.make +++ b/dist/etc/qnx/config-6.4.make @@ -34,47 +34,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 := y +XSDE_LONGLONG := y # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := y +XSDE_SNPRINTF := y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vc-8.0/config-max.nmake b/dist/etc/vc-8.0/config-max.nmake index 3d20d3c..07b46bb 100644 --- a/dist/etc/vc-8.0/config-max.nmake +++ b/dist/etc/vc-8.0/config-max.nmake @@ -32,47 +32,55 @@ XSDFLAGS = --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM = wince +XSDE_PLATFORM = wince # Platform architecture width in bits. # -XSDE_ARCH_WIDTH = 32 +XSDE_ARCH_WIDTH = 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER = l +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 +XSDE_STL = y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR = n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM = y +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 +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 +XSDE_LONGLONG = n # Set to 'n' if your platform doesn't have the _snprintf function. # -XSDE_SNPRINTF = y +XSDE_SNPRINTF = y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vc-8.0/config-min.nmake b/dist/etc/vc-8.0/config-min.nmake index e06055e..286e349 100644 --- a/dist/etc/vc-8.0/config-min.nmake +++ b/dist/etc/vc-8.0/config-min.nmake @@ -32,47 +32,55 @@ XSDFLAGS = --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM = wince +XSDE_PLATFORM = wince # Platform architecture width in bits. # -XSDE_ARCH_WIDTH = 32 +XSDE_ARCH_WIDTH = 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER = l +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 +XSDE_STL = n + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR = n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM = n +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 +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 +XSDE_LONGLONG = n # Set to 'n' if your platform doesn't have the _snprintf function. # -XSDE_SNPRINTF = y +XSDE_SNPRINTF = y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vc-9.0/config-max.nmake b/dist/etc/vc-9.0/config-max.nmake index 9442bc0..938bc3d 100644 --- a/dist/etc/vc-9.0/config-max.nmake +++ b/dist/etc/vc-9.0/config-max.nmake @@ -32,47 +32,55 @@ XSDFLAGS = --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM = wince +XSDE_PLATFORM = wince # Platform architecture width in bits. # -XSDE_ARCH_WIDTH = 32 +XSDE_ARCH_WIDTH = 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER = l +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 +XSDE_STL = y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR = n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM = y +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 +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 +XSDE_LONGLONG = n # Set to 'n' if your platform doesn't have the _snprintf function. # -XSDE_SNPRINTF = y +XSDE_SNPRINTF = y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vc-9.0/config-min.nmake b/dist/etc/vc-9.0/config-min.nmake index e55924b..b98e9a9 100644 --- a/dist/etc/vc-9.0/config-min.nmake +++ b/dist/etc/vc-9.0/config-min.nmake @@ -32,47 +32,55 @@ XSDFLAGS = --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM = wince +XSDE_PLATFORM = wince # Platform architecture width in bits. # -XSDE_ARCH_WIDTH = 32 +XSDE_ARCH_WIDTH = 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER = l +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 +XSDE_STL = n + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR = n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM = n +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 +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 +XSDE_LONGLONG = n # Set to 'n' if your platform doesn't have the _snprintf function. # -XSDE_SNPRINTF = y +XSDE_SNPRINTF = y # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vxworks/config-5.5.1.make b/dist/etc/vxworks/config-5.5.1.make index f0adac3..9d6d8c5 100644 --- a/dist/etc/vxworks/config-5.5.1.make +++ b/dist/etc/vxworks/config-5.5.1.make @@ -35,47 +35,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := b +XSDE_BYTEORDER := b # 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 +XSDE_STL := n + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := n +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 +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 +XSDE_LONGLONG := n # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := n +XSDE_SNPRINTF := n # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vxworks/config-6.4-max.make b/dist/etc/vxworks/config-6.4-max.make index a47fe7e..0d7ba41 100644 --- a/dist/etc/vxworks/config-6.4-max.make +++ b/dist/etc/vxworks/config-6.4-max.make @@ -47,47 +47,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 +XSDE_LONGLONG := n # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := n +XSDE_SNPRINTF := n # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vxworks/config-6.4-min.make b/dist/etc/vxworks/config-6.4-min.make index da395e8..3efd917 100644 --- a/dist/etc/vxworks/config-6.4-min.make +++ b/dist/etc/vxworks/config-6.4-min.make @@ -34,47 +34,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := n + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := n +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 +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 +XSDE_LONGLONG := n # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := n +XSDE_SNPRINTF := n # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vxworks/config-6.7-max.make b/dist/etc/vxworks/config-6.7-max.make index 762ca51..f6e8674 100644 --- a/dist/etc/vxworks/config-6.7-max.make +++ b/dist/etc/vxworks/config-6.7-max.make @@ -47,47 +47,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := y + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := y +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 +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 +XSDE_LONGLONG := n # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := n +XSDE_SNPRINTF := n # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/etc/vxworks/config-6.7-min.make b/dist/etc/vxworks/config-6.7-min.make index 206c719..42861a3 100644 --- a/dist/etc/vxworks/config-6.7-min.make +++ b/dist/etc/vxworks/config-6.7-min.make @@ -34,47 +34,55 @@ XSDFLAGS := --generate-inline # 'win32' - Windows 2000, XP, etc. # 'posix' - POSIX OS, including UNIX/Linux, VxWorks, etc. # -XSDE_PLATFORM := posix +XSDE_PLATFORM := posix # Platform architecture width in bits. # -XSDE_ARCH_WIDTH := 32 +XSDE_ARCH_WIDTH := 32 # Platform byte order. Valid values are 'b' for big-endian # and 'l' for little-endian. # -XSDE_BYTEORDER := l +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 +XSDE_STL := n + + +# Set to 'n' if you don't want iterators to conform to the STL +# requirements. This feature requires working header +# and allows you to use the standard algorithms such as find_if, +# etc. +# +XSDE_STL_ITERATOR := n # Set to 'n' if you don't have iostream. # -XSDE_IOSTREAM := n +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 +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 +XSDE_LONGLONG := n # Set to 'n' if your platform doesn't have the snprintf function. # -XSDE_SNPRINTF := n +XSDE_SNPRINTF := n # Set to 'n' if you don't want support for XML Schema validation in diff --git a/dist/libxsde/xsde/makefile b/dist/libxsde/xsde/makefile index 142c269..90f2252 100644 --- a/dist/libxsde/xsde/makefile +++ b/dist/libxsde/xsde/makefile @@ -509,6 +509,9 @@ endif ifeq ($(XSDE_STL),y) @echo $(h)define XSDE_STL >>$@ endif +ifeq ($(XSDE_STL_ITERATOR),y) + @echo $(h)define XSDE_STL_ITERATOR >>$@ +endif ifeq ($(XSDE_IOSTREAM),y) @echo $(h)define XSDE_IOSTREAM >>$@ endif diff --git a/dist/libxsde/xsde/nmakefile b/dist/libxsde/xsde/nmakefile index 888ca15..8eac019 100644 --- a/dist/libxsde/xsde/nmakefile +++ b/dist/libxsde/xsde/nmakefile @@ -504,6 +504,9 @@ config.h: !if "$(XSDE_STL)" == "y" @echo #define XSDE_STL >>$@ !endif +!if "$(XSDE_STL_ITERATOR)" == "y" + @echo #define XSDE_STL_ITERATOR >>$@ +!endif !if "$(XSDE_IOSTREAM)" == "y" @echo #define XSDE_IOSTREAM >>$@ !endif diff --git a/libxsde/xsde/cxx/hybrid/sequence.hxx b/libxsde/xsde/cxx/hybrid/sequence.hxx index 3c052e3..1f4e462 100644 --- a/libxsde/xsde/cxx/hybrid/sequence.hxx +++ b/libxsde/xsde/cxx/hybrid/sequence.hxx @@ -6,9 +6,14 @@ #ifndef XSDE_CXX_HYBRID_SEQUENCE_HXX #define XSDE_CXX_HYBRID_SEQUENCE_HXX +#include + #include // size_t, ptrdiff_t -#include +#ifdef XSDE_STL_ITERATOR +# include +#endif + #include #ifdef XSDE_STL @@ -270,6 +275,10 @@ namespace xsde typedef ptrdiff_t difference_type; +#ifdef XSDE_STL_ITERATOR + typedef std::random_access_iterator_tag iterator_category; +#endif + public: var_iterator () : i_ (0) @@ -377,6 +386,10 @@ namespace xsde typedef ptrdiff_t difference_type; +#ifdef XSDE_STL_ITERATOR + typedef std::random_access_iterator_tag iterator_category; +#endif + public: var_const_iterator () : i_ (0) diff --git a/libxsde/xsde/makefile b/libxsde/xsde/makefile index 845d206..f6cbaa2 100644 --- a/libxsde/xsde/makefile +++ b/libxsde/xsde/makefile @@ -522,6 +522,11 @@ ifeq ($(xsde_stl),y) else @echo '#undef XSDE_STL' >>$@ endif +ifeq ($(xsde_stl_iterator),y) + @echo '#define XSDE_STL_ITERATOR' >>$@ +else + @echo '#undef XSDE_STL_ITERATOR' >>$@ +endif ifeq ($(xsde_iostream),y) @echo '#define XSDE_IOSTREAM' >>$@ else diff --git a/tests/cxx/hybrid/iterator/driver.cxx b/tests/cxx/hybrid/iterator/driver.cxx new file mode 100644 index 0000000..cff3015 --- /dev/null +++ b/tests/cxx/hybrid/iterator/driver.cxx @@ -0,0 +1,62 @@ +// file : tests/cxx/hybrid/iterator/driver.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test conformance to STL iterator requirements. +// + +#include +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +struct fix_pred +{ + fix_pred (int v): v_ (v) {} + bool operator() (const fix& x) const {return x.a () == v_;} + int v_; +}; + +struct var_pred +{ + var_pred (const char* v): v_ (v) {} + bool operator() (const var& x) const {return x.a () == v_;} + const char* v_; +}; + +int +main () +{ + type::f_sequence fs; + + fix f; + f.a (1); + fs.push_back (f); + f.a (2); + fs.push_back (f); + f.a (3); + fs.push_back (f); + + assert (find_if (fs.begin (), fs.end (), fix_pred (2))->a () == 2); + + + type::v_sequence vs; + + var* v; + v = new var; + v->a ("a"); + vs.push_back (v); + v = new var; + v->a ("b"); + vs.push_back (v); + v = new var; + v->a ("c"); + vs.push_back (v); + + assert (find_if (vs.begin (), vs.end (), var_pred ("b"))->a () == "b"); +} diff --git a/tests/cxx/hybrid/iterator/makefile b/tests/cxx/hybrid/iterator/makefile new file mode 100644 index 0000000..74e62c3 --- /dev/null +++ b/tests/cxx/hybrid/iterator/makefile @@ -0,0 +1,80 @@ +# file : tests/cxx/hybrid/iterator/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 + +xsd := test.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.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 +test := $(out_base)/.test +clean := $(out_base)/.clean + + +# Build. +# +$(driver): $(obj) $(xsde.l) + +$(obj) $(dep): $(xsde.l.cpp-options) + +genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.cxx) +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): $(out_root)/xsde/xsde +$(gen): xsde := $(out_root)/xsde/xsde +$(gen): xsde_options += + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +$(out_base)/: $(driver) + + +# Test. +# +$(test): driver := $(driver) +$(test): $(driver) + $(call message,test $$1,$$1,$(driver)) + +# 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,$(scf_root)/xsde/hybrid/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsde/makefile) +$(call import,$(src_root)/libxsde/xsde/makefile) diff --git a/tests/cxx/hybrid/iterator/test.xsd b/tests/cxx/hybrid/iterator/test.xsd new file mode 100644 index 0000000..eb41ee1 --- /dev/null +++ b/tests/cxx/hybrid/iterator/test.xsd @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cxx/hybrid/makefile b/tests/cxx/hybrid/makefile index fe1bccf..a30ac41 100644 --- a/tests/cxx/hybrid/makefile +++ b/tests/cxx/hybrid/makefile @@ -11,6 +11,12 @@ ifeq ($(xsde_polymorphic),y) tests += polymorphism endif +ifeq ($(xsde_stl),y) +ifeq ($(xsde_stl_iterator),y) +tests += iterator +endif +endif + ifeq ($(xsde_iostream),y) tests += built-in default list recursive test-template union @@ -26,7 +32,7 @@ ifeq ($(xsde_parser_validation),y) tests += choice endif -endif +endif # xsde_iostream default := $(out_base)/ test := $(out_base)/.test -- cgit v1.1