From bada6666c70977a058755ccf232e7d67b24adeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:21:29 +0200 Subject: New upstream release --- libxsd-frontend/INSTALL | 11 +- libxsd-frontend/NEWS | 29 +- libxsd-frontend/build/bootstrap.make | 9 +- libxsd-frontend/build/configuration-dynamic.make | 1 + .../build/cxx/configuration-dynamic.make | 5 +- .../build/cxx/generic/configuration-dynamic.make | 5 + .../build/cxx/gnu/configuration-dynamic.make | 8 - .../build/export/libxsd-frontend/stub.make | 3 +- libxsd-frontend/build/import/libboost/LICENSE | 340 ------ .../import/libboost/configuration-dynamic.make | 8 - .../build/import/libboost/configuration-rules.make | 15 - libxsd-frontend/build/import/libboost/configure | 74 -- .../build/import/libboost/filesystem/rules.make | 53 - .../build/import/libboost/filesystem/stub.make | 36 - libxsd-frontend/build/import/libboost/version | 1 - libxsd-frontend/build/import/libcult/LICENSE | 340 ------ .../import/libcult/configuration-dynamic.make | 4 - .../build/import/libcult/configuration-rules.make | 15 - libxsd-frontend/build/import/libcult/configure | 55 - libxsd-frontend/build/import/libcult/stub.make | 30 - libxsd-frontend/build/import/libcutl/LICENSE | 24 + .../import/libcutl/configuration-dynamic.make | 8 + .../build/import/libcutl/configuration-rules.make | 14 + libxsd-frontend/build/import/libcutl/configure | 54 + libxsd-frontend/build/import/libcutl/stub.make | 29 + .../build/import/libfrontend-elements/LICENSE | 340 ------ .../configuration-dynamic.make | 4 - .../libfrontend-elements/configuration-rules.make | 15 - .../build/import/libfrontend-elements/configure | 55 - .../build/import/libfrontend-elements/stub.make | 30 - .../import/libxerces-c/configuration-rules.make | 1 - libxsd-frontend/build/import/libxerces-c/configure | 1 - .../build/import/libxerces-c/rules.make | 1 - libxsd-frontend/build/import/libxerces-c/stub.make | 1 - .../libxsd-frontend/configuration-rules.make | 3 +- .../build/import/libxsd-frontend/configure | 3 +- .../build/import/libxsd-frontend/stub.make | 5 +- .../build/ld/configuration-lib-dynamic.make | 4 +- libxsd-frontend/makefile | 3 +- libxsd-frontend/tests/dump/driver.cxx | 93 +- libxsd-frontend/tests/dump/makefile | 3 +- libxsd-frontend/tests/makefile | 3 +- libxsd-frontend/tests/schema/annotation/makefile | 3 +- libxsd-frontend/tests/schema/anonymous/makefile | 3 +- .../tests/schema/attribute-group/makefile | 3 +- libxsd-frontend/tests/schema/default/makefile | 3 +- .../tests/schema/element-group/makefile | 3 +- libxsd-frontend/tests/schema/enumeration/makefile | 3 +- libxsd-frontend/tests/schema/makefile | 3 +- libxsd-frontend/tests/schema/union/makefile | 3 +- libxsd-frontend/version | 2 +- .../xsd-frontend/generators/dependencies.cxx | 70 ++ .../xsd-frontend/generators/dependencies.hxx | 32 + libxsd-frontend/xsd-frontend/makefile | 37 +- libxsd-frontend/xsd-frontend/parser.cxx | 1224 ++++++++++---------- libxsd-frontend/xsd-frontend/parser.hxx | 38 +- libxsd-frontend/xsd-frontend/schema-dom-parser.cxx | 25 +- libxsd-frontend/xsd-frontend/schema-dom-parser.hxx | 17 +- libxsd-frontend/xsd-frontend/semantic-graph.hxx | 3 +- .../xsd-frontend/semantic-graph/annotation.cxx | 25 +- .../xsd-frontend/semantic-graph/annotation.hxx | 46 +- .../xsd-frontend/semantic-graph/any-attribute.cxx | 57 +- .../xsd-frontend/semantic-graph/any-attribute.hxx | 29 +- .../xsd-frontend/semantic-graph/any.cxx | 59 +- .../xsd-frontend/semantic-graph/any.hxx | 29 +- .../semantic-graph/attribute-group.cxx | 31 +- .../semantic-graph/attribute-group.hxx | 11 +- .../xsd-frontend/semantic-graph/attribute.cxx | 43 +- .../xsd-frontend/semantic-graph/attribute.hxx | 21 +- .../xsd-frontend/semantic-graph/complex.cxx | 43 +- .../xsd-frontend/semantic-graph/complex.hxx | 53 +- .../xsd-frontend/semantic-graph/compositors.cxx | 120 +- .../xsd-frontend/semantic-graph/compositors.hxx | 119 +- .../xsd-frontend/semantic-graph/element-group.cxx | 30 +- .../xsd-frontend/semantic-graph/element-group.hxx | 15 +- .../xsd-frontend/semantic-graph/element.cxx | 60 +- .../xsd-frontend/semantic-graph/element.hxx | 37 +- .../xsd-frontend/semantic-graph/elements.cxx | 193 ++- .../xsd-frontend/semantic-graph/elements.hxx | 536 +++------ .../xsd-frontend/semantic-graph/enumeration.cxx | 58 +- .../xsd-frontend/semantic-graph/enumeration.hxx | 15 +- .../xsd-frontend/semantic-graph/fundamental.cxx | 1143 ++++++++++++++++++ .../xsd-frontend/semantic-graph/fundamental.cxx.m4 | 55 +- .../xsd-frontend/semantic-graph/fundamental.hxx | 516 +++++++++ .../xsd-frontend/semantic-graph/fundamental.hxx.m4 | 32 +- .../xsd-frontend/semantic-graph/fundamental.m4 | 3 +- .../xsd-frontend/semantic-graph/list.cxx | 29 +- .../xsd-frontend/semantic-graph/list.hxx | 9 +- .../xsd-frontend/semantic-graph/namespace.cxx | 29 +- .../xsd-frontend/semantic-graph/namespace.hxx | 15 +- .../xsd-frontend/semantic-graph/particle.cxx | 57 +- .../xsd-frontend/semantic-graph/particle.hxx | 37 +- .../xsd-frontend/semantic-graph/schema.cxx | 121 +- .../xsd-frontend/semantic-graph/schema.hxx | 152 +-- .../xsd-frontend/semantic-graph/union.cxx | 29 +- .../xsd-frontend/semantic-graph/union.hxx | 9 +- .../xsd-frontend/transformations/anonymous.cxx | 377 +++++- .../xsd-frontend/transformations/anonymous.hxx | 21 +- .../transformations/enum-synthesis.cxx | 20 +- .../transformations/enum-synthesis.hxx | 9 +- .../xsd-frontend/transformations/restriction.cxx | 56 +- .../xsd-frontend/transformations/restriction.hxx | 9 +- .../transformations/schema-per-type.cxx | 148 +-- .../transformations/schema-per-type.hxx | 23 +- .../xsd-frontend/transformations/simplifier.cxx | 23 +- .../xsd-frontend/transformations/simplifier.hxx | 9 +- libxsd-frontend/xsd-frontend/traversal.hxx | 3 +- .../xsd-frontend/traversal/any-attribute.hxx | 3 +- libxsd-frontend/xsd-frontend/traversal/any.hxx | 3 +- .../xsd-frontend/traversal/attribute-group.cxx | 9 +- .../xsd-frontend/traversal/attribute-group.hxx | 9 +- .../xsd-frontend/traversal/attribute.cxx | 17 +- .../xsd-frontend/traversal/attribute.hxx | 17 +- libxsd-frontend/xsd-frontend/traversal/complex.cxx | 23 +- libxsd-frontend/xsd-frontend/traversal/complex.hxx | 23 +- .../xsd-frontend/traversal/compositors.cxx | 55 +- .../xsd-frontend/traversal/compositors.hxx | 55 +- .../xsd-frontend/traversal/element-group.cxx | 15 +- .../xsd-frontend/traversal/element-group.hxx | 15 +- libxsd-frontend/xsd-frontend/traversal/element.cxx | 17 +- libxsd-frontend/xsd-frontend/traversal/element.hxx | 17 +- .../xsd-frontend/traversal/elements.cxx | 27 +- .../xsd-frontend/traversal/elements.hxx | 221 ++-- .../xsd-frontend/traversal/elements.txx | 3 +- .../xsd-frontend/traversal/enumeration.cxx | 31 +- .../xsd-frontend/traversal/enumeration.hxx | 31 +- .../xsd-frontend/traversal/fundamental.cxx | 3 +- .../xsd-frontend/traversal/fundamental.hxx | 3 +- libxsd-frontend/xsd-frontend/traversal/list.cxx | 17 +- libxsd-frontend/xsd-frontend/traversal/list.hxx | 17 +- .../xsd-frontend/traversal/namespace.cxx | 3 +- .../xsd-frontend/traversal/namespace.hxx | 11 +- .../xsd-frontend/traversal/particle.cxx | 9 +- .../xsd-frontend/traversal/particle.hxx | 9 +- libxsd-frontend/xsd-frontend/traversal/schema.cxx | 3 +- libxsd-frontend/xsd-frontend/traversal/schema.hxx | 19 +- libxsd-frontend/xsd-frontend/traversal/union.cxx | 17 +- libxsd-frontend/xsd-frontend/traversal/union.hxx | 17 +- libxsd-frontend/xsd-frontend/types.cxx | 61 + libxsd-frontend/xsd-frontend/types.hxx | 242 +++- libxsd-frontend/xsd-frontend/version.hxx | 14 + libxsd-frontend/xsd-frontend/xml.hxx | 86 +- 142 files changed, 4638 insertions(+), 4256 deletions(-) create mode 100644 libxsd-frontend/build/configuration-dynamic.make create mode 100644 libxsd-frontend/build/cxx/generic/configuration-dynamic.make delete mode 100644 libxsd-frontend/build/cxx/gnu/configuration-dynamic.make delete mode 100644 libxsd-frontend/build/import/libboost/LICENSE delete mode 100644 libxsd-frontend/build/import/libboost/configuration-dynamic.make delete mode 100644 libxsd-frontend/build/import/libboost/configuration-rules.make delete mode 100755 libxsd-frontend/build/import/libboost/configure delete mode 100644 libxsd-frontend/build/import/libboost/filesystem/rules.make delete mode 100644 libxsd-frontend/build/import/libboost/filesystem/stub.make delete mode 100644 libxsd-frontend/build/import/libboost/version delete mode 100644 libxsd-frontend/build/import/libcult/LICENSE delete mode 100644 libxsd-frontend/build/import/libcult/configuration-dynamic.make delete mode 100644 libxsd-frontend/build/import/libcult/configuration-rules.make delete mode 100755 libxsd-frontend/build/import/libcult/configure delete mode 100644 libxsd-frontend/build/import/libcult/stub.make create mode 100644 libxsd-frontend/build/import/libcutl/LICENSE create mode 100644 libxsd-frontend/build/import/libcutl/configuration-dynamic.make create mode 100644 libxsd-frontend/build/import/libcutl/configuration-rules.make create mode 100755 libxsd-frontend/build/import/libcutl/configure create mode 100644 libxsd-frontend/build/import/libcutl/stub.make delete mode 100644 libxsd-frontend/build/import/libfrontend-elements/LICENSE delete mode 100644 libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make delete mode 100644 libxsd-frontend/build/import/libfrontend-elements/configuration-rules.make delete mode 100755 libxsd-frontend/build/import/libfrontend-elements/configure delete mode 100644 libxsd-frontend/build/import/libfrontend-elements/stub.make create mode 100644 libxsd-frontend/xsd-frontend/generators/dependencies.cxx create mode 100644 libxsd-frontend/xsd-frontend/generators/dependencies.hxx create mode 100644 libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx create mode 100644 libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx create mode 100644 libxsd-frontend/xsd-frontend/types.cxx create mode 100644 libxsd-frontend/xsd-frontend/version.hxx (limited to 'libxsd-frontend') diff --git a/libxsd-frontend/INSTALL b/libxsd-frontend/INSTALL index 756b7e4..0d0b70d 100644 --- a/libxsd-frontend/INSTALL +++ b/libxsd-frontend/INSTALL @@ -2,16 +2,13 @@ Prerequisites build-time: - - build >= 0.3.7 http://www.codesynthesis.com/projects/build/ - - g++ >= 3.4.3 http://gcc.gnu.org + - g++ >= 3.4.3 http://gcc.gnu.org + - build >= 0.3.10 http://www.codesynthesis.com/projects/build/ run-time: - - libfrontend-elements >= 1.1.4 http://kolpackov.net/projects/libfrontend-elements/ - - libcult >= 1.4.6 http://kolpackov.net/projects/libcult/ - - libxerces-c >= 2.6.0 http://xerces.apache.org/xerces-c/ - - libboost_filesystem >= 1.33.1 http://boost.org - + - libxerces-c >= 3.0.0 http://xerces.apache.org/xerces-c/ + - libcutl >= 1.8.0 http://www.codesynthesis.com/projects/libcutl/ Building libxsd-frontend diff --git a/libxsd-frontend/NEWS b/libxsd-frontend/NEWS index aca46a7..1e216ef 100644 --- a/libxsd-frontend/NEWS +++ b/libxsd-frontend/NEWS @@ -1,6 +1,23 @@ +Version 2.0.0 + + * New major version with removed dependencies (now only depends on + libcutl) and no longer supports Xerces-C++ 2-series. + + * Support for fat type files. + + * Generator that returns list of included/imported schemas. + +Version 1.18.0 + + * Add support for multiple pattern facets. + + * Use normalized base path to construct absolute path. + + * Trim leading and trailing whitespaces in XML Schema attributes. + Version 1.17.0 - * Add support for resolving default/fixed values of QName type. Now + * Add support for resolving default/fixed values of QName type. Now the qualified value is represented in the # form. * Anonymous transformation now passes the actual file path instead of @@ -11,7 +28,7 @@ Version 1.17.0 * Do not copy ref'ed default values for non-optional attributes. - * Change predicate names in the semantic graph to consistently end + * Change predicate names in the semantic graph to consistently end with _p. * New transformation: enum synthesis. @@ -21,12 +38,12 @@ Version 1.17.0 * Add support for translating schema file paths. Version 1.16.0 - + * New transformation: simplifier. It simplifies the schema graph by, for example, removing empty compositors where it would not change the semantics of the schema. - * Added min() and max() accessors to the Particle and Compositor + * Added min() and max() accessors to the Particle and Compositor semantic graph nodes. * Added optional strong include key to the schema-per-type @@ -37,7 +54,7 @@ Version 1.15.0 * Support for the simple type/simple content restriction facets. * Support for suppressing frontend warnings. - + * Support for suppressing full schema checking. * Support for the interface changes introduced in Xerces-C++ 3.0.0.b2. @@ -51,7 +68,7 @@ Version 1.14.0 * Support for UTF-32 and UTF-16 in wchar_t. * Fixed a bug in import stubs. - + * Got rid of warnings reported by g++-4.3. Version 1.13.0 diff --git a/libxsd-frontend/build/bootstrap.make b/libxsd-frontend/build/bootstrap.make index 4db3c99..bb1a5aa 100644 --- a/libxsd-frontend/build/bootstrap.make +++ b/libxsd-frontend/build/bootstrap.make @@ -1,6 +1,5 @@ # file : build/bootstrap.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file project_name := libxsd-frontend @@ -16,6 +15,10 @@ ifeq ($(patsubst %build/bootstrap.make,,$(lastword $(MAKEFILE_LIST))),) include $(build)/bootstrap.make endif +# Configuration (optional; only used in the +dep packages). +# +$(call -include,$(dcf_root)/configuration-dynamic.make) + # Aliases # .PHONY: $(out_base)/ \ @@ -41,6 +44,6 @@ define include-dep $(call -include,$1) endef -ifneq ($(filter $(MAKECMDGOALS),clean cleandoc disfigure),) +ifneq ($(filter $(MAKECMDGOALS),clean disfigure),) include-dep = endif diff --git a/libxsd-frontend/build/configuration-dynamic.make b/libxsd-frontend/build/configuration-dynamic.make new file mode 100644 index 0000000..d681b0b --- /dev/null +++ b/libxsd-frontend/build/configuration-dynamic.make @@ -0,0 +1 @@ +libxsd_frontend_clean_gen := n diff --git a/libxsd-frontend/build/cxx/configuration-dynamic.make b/libxsd-frontend/build/cxx/configuration-dynamic.make index 568ab40..83cf860 100644 --- a/libxsd-frontend/build/cxx/configuration-dynamic.make +++ b/libxsd-frontend/build/cxx/configuration-dynamic.make @@ -1,7 +1,4 @@ -cxx_id := gnu -cxx_optimize := n -cxx_debug := n -cxx_rpath := n +cxx_id := generic cxx_pp_extra_options := $(CPPFLAGS) cxx_extra_options := $(CXXFLAGS) cxx_ld_extra_options := $(LDFLAGS) diff --git a/libxsd-frontend/build/cxx/generic/configuration-dynamic.make b/libxsd-frontend/build/cxx/generic/configuration-dynamic.make new file mode 100644 index 0000000..c43865a --- /dev/null +++ b/libxsd-frontend/build/cxx/generic/configuration-dynamic.make @@ -0,0 +1,5 @@ +ifeq ($(filter $(origin CXX),undefined default),) +cxx_generic := $(CXX) +else +cxx_generic := g++ +endif diff --git a/libxsd-frontend/build/cxx/gnu/configuration-dynamic.make b/libxsd-frontend/build/cxx/gnu/configuration-dynamic.make deleted file mode 100644 index f3fe64d..0000000 --- a/libxsd-frontend/build/cxx/gnu/configuration-dynamic.make +++ /dev/null @@ -1,8 +0,0 @@ -ifneq ($(CXX),) -cxx_gnu := $(CXX) -else -cxx_gnu := g++ -endif - -cxx_gnu_libraries := -cxx_gnu_optimization_options := diff --git a/libxsd-frontend/build/export/libxsd-frontend/stub.make b/libxsd-frontend/build/export/libxsd-frontend/stub.make index adae4b7..8575358 100644 --- a/libxsd-frontend/build/export/libxsd-frontend/stub.make +++ b/libxsd-frontend/build/export/libxsd-frontend/stub.make @@ -1,6 +1,5 @@ # file : build/import/libxsd-frontend/stub.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file $(call include-once,$(src_root)/xsd-frontend/makefile,$(out_root)) diff --git a/libxsd-frontend/build/import/libboost/LICENSE b/libxsd-frontend/build/import/libboost/LICENSE deleted file mode 100644 index 3912109..0000000 --- a/libxsd-frontend/build/import/libboost/LICENSE +++ /dev/null @@ -1,340 +0,0 @@ - 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/libxsd-frontend/build/import/libboost/configuration-dynamic.make b/libxsd-frontend/build/import/libboost/configuration-dynamic.make deleted file mode 100644 index ab55882..0000000 --- a/libxsd-frontend/build/import/libboost/configuration-dynamic.make +++ /dev/null @@ -1,8 +0,0 @@ -libboost_installed := y -libboost_suffix := $(BOOST_LIB_SUFFIX) - -ifeq ($(BOOST_LINK_SYSTEM),n) -libboost_system := n -else -libboost_system := y -endif diff --git a/libxsd-frontend/build/import/libboost/configuration-rules.make b/libxsd-frontend/build/import/libboost/configuration-rules.make deleted file mode 100644 index 40fff9f..0000000 --- a/libxsd-frontend/build/import/libboost/configuration-rules.make +++ /dev/null @@ -1,15 +0,0 @@ -# file : build/import/libboost/configuration-rules.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(dcf_root)/import/libboost/configuration-dynamic.make: | $(dcf_root)/import/libboost/. - $(call message,,$(scf_root)/import/libboost/configure $@) - -ifndef %foreign% - -disfigure:: - $(call message,rm $(dcf_root)/import/libboost/configuration-dynamic.make,\ -rm -f $(dcf_root)/import/libboost/configuration-dynamic.make) - -endif diff --git a/libxsd-frontend/build/import/libboost/configure b/libxsd-frontend/build/import/libboost/configure deleted file mode 100755 index c924a30..0000000 --- a/libxsd-frontend/build/import/libboost/configure +++ /dev/null @@ -1,74 +0,0 @@ -#! /usr/bin/env bash - -# file : build/import/libboost/configure -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 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 'boost libraries' for '$project_name'." -$echo - -$echo -$echo "Would you like to configure dependency on the installed version" -$echo "of 'boost libraries' as opposed to the development build?" -$echo - -installed=`read_y_n y` - -if [ "$installed" = "n" ]; then - - $echo - $echo "Please enter the 'boost' root directory." - $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 -$echo "Link explicitly to the boost system library? This library" -$echo "is available since boost 1.35.0 and linking to it explicitly" -$echo "may be required by newer linkers." -$echo - -link_system=`read_y_n y` - -$echo -$echo "Please enter optional suffix that may be embedded into the" -$echo "boost library names. For example, if your library names are in" -$echo "the libboost_regex-gcc41-mt-d.so form, then enter -gcc41-mt-d" -$echo "Otherwise leave this field blank." -$echo - -suffix= -read -e -p "[]: " suffix - -echo libboost_installed := $installed >$1 -echo libboost_suffix := $suffix >>$1 -echo libboost_system := $link_system >>$1 - -if [ "$installed" = "n" ]; then - - echo libboost_root := $root >>$1 - echo libboost_type := $type >>$1 - -fi diff --git a/libxsd-frontend/build/import/libboost/filesystem/rules.make b/libxsd-frontend/build/import/libboost/filesystem/rules.make deleted file mode 100644 index b5febd3..0000000 --- a/libxsd-frontend/build/import/libboost/filesystem/rules.make +++ /dev/null @@ -1,53 +0,0 @@ -# file : build/import/libboost/filesystem/rules.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -#@@ Should use message everywhere. -# - -$(dcf_root)/import/libboost/%: root := $(libboost_root) - -$(dcf_root)/import/libboost/filesystem/filesystem.l: \ - | $(dcf_root)/import/libboost/filesystem/. - -ifeq ($(libboost_type),archive) - -ifeq ($(libboost_system),y) -$(dcf_root)/import/libboost/filesystem/filesystem.l: \ - $(libboost_root)/stage/lib/libboost_filesystem$(libboost_suffix).a \ - $(libboost_root)/stage/lib/libboost_system$(libboost_suffix).a -else -$(dcf_root)/import/libboost/filesystem/filesystem.l: \ - $(libboost_root)/stage/lib/libboost_filesystem$(libboost_suffix).a -endif - @echo $^ >$@ - -else - -ifeq ($(libboost_system),y) -$(dcf_root)/import/libboost/filesystem/filesystem.l: \ - $(libboost_root)/stage/lib/libboost_filesystem$(libboost_suffix).so \ - $(libboost_root)/stage/lib/libboost_system$(libboost_suffix).so -else -$(dcf_root)/import/libboost/filesystem/filesystem.l: \ - $(libboost_root)/stage/lib/libboost_filesystem$(libboost_suffix).so -endif - @echo $^ >$@ - @echo rpath:$(root)/stage/lib >>$@ - -endif - - -$(dcf_root)/import/libboost/filesystem/filesystem.l.cpp-options: \ - | $(dcf_root)/import/libboost/filesystem/. - @echo include: -I$(root) >$@ - -ifndef %foreign% - -disfigure:: - $(call message,rm $(dcf_root)/import/libboost/filesystem/filesystem.l,\ -rm -f $(dcf_root)/import/libboost/filesystem/filesystem.l) - $(call message,,rm -f $(dcf_root)/import/libboost/filesystem/filesystem.l.cpp-options) - -endif diff --git a/libxsd-frontend/build/import/libboost/filesystem/stub.make b/libxsd-frontend/build/import/libboost/filesystem/stub.make deleted file mode 100644 index fb7398d..0000000 --- a/libxsd-frontend/build/import/libboost/filesystem/stub.make +++ /dev/null @@ -1,36 +0,0 @@ -# file : build/import/libboost/filesystem/stub.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(call include-once,$(scf_root)/import/libboost/configuration-rules.make,$(dcf_root)) - -libboost_installed := - -$(call -include,$(dcf_root)/import/libboost/configuration-dynamic.make) - -ifdef libboost_installed - -ifeq ($(libboost_installed),y) - -ifeq ($(libboost_system),y) -$(call export,l: -lboost_filesystem$(libboost_suffix) -lboost_system$(libboost_suffix),cpp_options: ) -else -$(call export,l: -lboost_filesystem$(libboost_suffix),cpp_options: ) -endif - -else - -$(call include-once,$(scf_root)/import/libboost/filesystem/rules.make,$(dcf_root)) - -$(call export,\ - l: $(dcf_root)/import/libboost/filesystem/filesystem.l,\ - cpp-options: $(dcf_root)/import/libboost/filesystem/filesystem.l.cpp-options) - -endif - -else - -.NOTPARALLEL: - -endif diff --git a/libxsd-frontend/build/import/libboost/version b/libxsd-frontend/build/import/libboost/version deleted file mode 100644 index faef31a..0000000 --- a/libxsd-frontend/build/import/libboost/version +++ /dev/null @@ -1 +0,0 @@ -0.7.0 diff --git a/libxsd-frontend/build/import/libcult/LICENSE b/libxsd-frontend/build/import/libcult/LICENSE deleted file mode 100644 index 3912109..0000000 --- a/libxsd-frontend/build/import/libcult/LICENSE +++ /dev/null @@ -1,340 +0,0 @@ - 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/libxsd-frontend/build/import/libcult/configuration-dynamic.make b/libxsd-frontend/build/import/libcult/configuration-dynamic.make deleted file mode 100644 index 73c92bb..0000000 --- a/libxsd-frontend/build/import/libcult/configuration-dynamic.make +++ /dev/null @@ -1,4 +0,0 @@ -libcult_installed := n -src_root := $(abspath $(src_root)/../libcult) -scf_root := $(src_root)/build -out_root := $(src_root) diff --git a/libxsd-frontend/build/import/libcult/configuration-rules.make b/libxsd-frontend/build/import/libcult/configuration-rules.make deleted file mode 100644 index dc19df4..0000000 --- a/libxsd-frontend/build/import/libcult/configuration-rules.make +++ /dev/null @@ -1,15 +0,0 @@ -# file : build/import/libcult/configuration-rules.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(dcf_root)/import/libcult/configuration-dynamic.make: | $(dcf_root)/import/libcult/. - $(call message,,$(scf_root)/import/libcult/configure $@) - -ifndef %foreign% - -disfigure:: - $(call message,rm $(dcf_root)/import/libcult/configuration-dynamic.make,\ -rm -f $(dcf_root)/import/libcult/configuration-dynamic.make) - -endif diff --git a/libxsd-frontend/build/import/libcult/configure b/libxsd-frontend/build/import/libcult/configure deleted file mode 100755 index afa4c9c..0000000 --- a/libxsd-frontend/build/import/libcult/configure +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env bash - -# file : build/import/libcult/configure -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - - -# $1 - out file -# -# bld_root - build root -# project_name - project name -# - -source $bld_root/dialog.bash - - -$echo -$echo "Configuring external dependency on 'libcult' for '$project_name'." -$echo - -$echo -$echo "Would you like to configure dependency on the installed " -$echo "version of 'libcult' as opposed to the development build?" -$echo - -installed=`read_y_n y` - -path= - -if [ "$installed" = "n" ]; then - -$echo -$echo "Please enter the src_root for 'libcult'." -$echo - -src_root=`read_path --directory --exist` - -$echo -$echo "Please enter the out_root for 'libcult'." -$echo - -out_root=`read_path --directory $src_root` - -fi - -echo libcult_installed := $installed >$1 - -if [ "$installed" = "n" ]; then - -echo src_root := $src_root >>$1 -echo scf_root := \$\(src_root\)/build >>$1 -echo out_root := $out_root >>$1 - -fi diff --git a/libxsd-frontend/build/import/libcult/stub.make b/libxsd-frontend/build/import/libcult/stub.make deleted file mode 100644 index f5f7691..0000000 --- a/libxsd-frontend/build/import/libcult/stub.make +++ /dev/null @@ -1,30 +0,0 @@ -# file : build/import/libcult/stub.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(call include-once,$(scf_root)/import/libcult/configuration-rules.make,$(dcf_root)) - -libcult_installed := - -$(call -include,$(dcf_root)/import/libcult/configuration-dynamic.make) - -ifdef libcult_installed - -ifeq ($(libcult_installed),y) - -$(call export,l: -lcult,cpp-options: ) - -else - -# Include export stub. -# -$(call include,$(scf_root)/export/libcult/stub.make) - -endif - -else - -.NOTPARALLEL: - -endif diff --git a/libxsd-frontend/build/import/libcutl/LICENSE b/libxsd-frontend/build/import/libcutl/LICENSE new file mode 100644 index 0000000..6b90d44 --- /dev/null +++ b/libxsd-frontend/build/import/libcutl/LICENSE @@ -0,0 +1,24 @@ +Code found in the cutl/details/boost/ directory is distributed under +the Boost Software License (see the accompanying LICENSE file). + +The rest is Copyright (c) 2009-2011 Code Synthesis Tools CC and is +distributed under the following license (MIT License): + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/libxsd-frontend/build/import/libcutl/configuration-dynamic.make b/libxsd-frontend/build/import/libcutl/configuration-dynamic.make new file mode 100644 index 0000000..4e4bb83 --- /dev/null +++ b/libxsd-frontend/build/import/libcutl/configuration-dynamic.make @@ -0,0 +1,8 @@ +ifeq ($(EXTERNAL_LIBCUTL),y) +libcutl_installed := y +else +libcutl_installed := n +src_root := $(abspath $(src_root)/../libcutl) +scf_root := $(src_root)/build +out_root := $(src_root) +endif diff --git a/libxsd-frontend/build/import/libcutl/configuration-rules.make b/libxsd-frontend/build/import/libcutl/configuration-rules.make new file mode 100644 index 0000000..b9fcabc --- /dev/null +++ b/libxsd-frontend/build/import/libcutl/configuration-rules.make @@ -0,0 +1,14 @@ +# file : build/import/libcutl/configuration-rules.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +$(dcf_root)/import/libcutl/configuration-dynamic.make: | $(dcf_root)/import/libcutl/. + $(call message,,$(scf_root)/import/libcutl/configure $@) + +ifndef %foreign% + +$(dcf_root)/.disfigure:: + $(call message,rm $(dcf_root)/import/libcutl/configuration-dynamic.make,\ +rm -f $(dcf_root)/import/libcutl/configuration-dynamic.make) + +endif diff --git a/libxsd-frontend/build/import/libcutl/configure b/libxsd-frontend/build/import/libcutl/configure new file mode 100755 index 0000000..8adb631 --- /dev/null +++ b/libxsd-frontend/build/import/libcutl/configure @@ -0,0 +1,54 @@ +#! /usr/bin/env bash + +# file : build/import/libcutl/configure +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + + +# $1 - out file +# +# bld_root - build root +# project_name - project name +# + +source $bld_root/dialog.bash + + +$echo +$echo "Configuring external dependency on 'libcutl' for '$project_name'." +$echo + +$echo +$echo "Would you like to configure dependency on the installed " +$echo "version of 'libcutl' as opposed to the development build?" +$echo + +installed=`read_y_n y` + +path= + +if [ "$installed" = "n" ]; then + +$echo +$echo "Please enter the src_root for 'libcutl'." +$echo + +src_root=`read_path --directory --exist` + +$echo +$echo "Please enter the out_root for 'libcutl'." +$echo + +out_root=`read_path --directory $src_root` + +fi + +echo libcutl_installed := $installed >$1 + +if [ "$installed" = "n" ]; then + +echo src_root := $src_root >>$1 +echo scf_root := \$\(src_root\)/build >>$1 +echo out_root := $out_root >>$1 + +fi diff --git a/libxsd-frontend/build/import/libcutl/stub.make b/libxsd-frontend/build/import/libcutl/stub.make new file mode 100644 index 0000000..1ec4716 --- /dev/null +++ b/libxsd-frontend/build/import/libcutl/stub.make @@ -0,0 +1,29 @@ +# file : build/import/libcutl/stub.make +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +$(call include-once,$(scf_root)/import/libcutl/configuration-rules.make,$(dcf_root)) + +libcutl_installed := + +$(call -include,$(dcf_root)/import/libcutl/configuration-dynamic.make) + +ifdef libcutl_installed + +ifeq ($(libcutl_installed),y) + +$(call export,l: -lcutl,cpp-options: ) + +else + +# Include export stub. +# +$(call include,$(scf_root)/export/libcutl/stub.make) + +endif + +else + +.NOTPARALLEL: + +endif diff --git a/libxsd-frontend/build/import/libfrontend-elements/LICENSE b/libxsd-frontend/build/import/libfrontend-elements/LICENSE deleted file mode 100644 index 3912109..0000000 --- a/libxsd-frontend/build/import/libfrontend-elements/LICENSE +++ /dev/null @@ -1,340 +0,0 @@ - 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/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make b/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make deleted file mode 100644 index 70d0da6..0000000 --- a/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make +++ /dev/null @@ -1,4 +0,0 @@ -libfrontend_elements_installed := n -src_root := $(abspath $(src_root)/../libfrontend-elements) -scf_root := $(src_root)/build -out_root := $(src_root) diff --git a/libxsd-frontend/build/import/libfrontend-elements/configuration-rules.make b/libxsd-frontend/build/import/libfrontend-elements/configuration-rules.make deleted file mode 100644 index a7db697..0000000 --- a/libxsd-frontend/build/import/libfrontend-elements/configuration-rules.make +++ /dev/null @@ -1,15 +0,0 @@ -# file : build/import/libfrontend-elements/configuration-rules.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(dcf_root)/import/libfrontend-elements/configuration-dynamic.make: | $(dcf_root)/import/libfrontend-elements/. - $(call message,,$(scf_root)/import/libfrontend-elements/configure $@) - -ifndef %foreign% - -disfigure:: - $(call message,rm $(dcf_root)/import/libfrontend-elements/configuration-dynamic.make,\ -rm -f $(dcf_root)/import/libfrontend-elements/configuration-dynamic.make) - -endif diff --git a/libxsd-frontend/build/import/libfrontend-elements/configure b/libxsd-frontend/build/import/libfrontend-elements/configure deleted file mode 100755 index d02b4f7..0000000 --- a/libxsd-frontend/build/import/libfrontend-elements/configure +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env bash - -# file : build/import/libfrontend-elements/configure -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - - -# $1 - out file -# -# bld_root - build root -# project_name - project name -# - -source $bld_root/dialog.bash - - -$echo -$echo "Configuring external dependency on 'libfrontend-elements' for '$project_name'." -$echo - -$echo -$echo "Would you like to configure dependency on the installed version" -$echo "of 'libfrontend-elements' as opposed to the development build?" -$echo - -installed=`read_y_n y` - -path= - -if [ "$installed" = "n" ]; then - -$echo -$echo "Please enter the src_root for 'libfrontend-elements'." -$echo - -src_root=`read_path --directory --exist` - -$echo -$echo "Please enter the out_root for 'libfrontend-elements'." -$echo - -out_root=`read_path --directory $src_root` - -fi - -echo libfrontend_elements_installed := $installed >$1 - -if [ "$installed" = "n" ]; then - -echo src_root := $src_root >>$1 -echo scf_root := \$\(src_root\)/build >>$1 -echo out_root := $out_root >>$1 - -fi diff --git a/libxsd-frontend/build/import/libfrontend-elements/stub.make b/libxsd-frontend/build/import/libfrontend-elements/stub.make deleted file mode 100644 index d701305..0000000 --- a/libxsd-frontend/build/import/libfrontend-elements/stub.make +++ /dev/null @@ -1,30 +0,0 @@ -# file : build/import/libfrontend-elements/stub.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2009 Boris Kolpackov -# license : GNU GPL v2; see accompanying LICENSE file - -$(call include-once,$(scf_root)/import/libfrontend-elements/configuration-rules.make,$(dcf_root)) - -libfrontend_elements_installed := - -$(call -include,$(dcf_root)/import/libfrontend-elements/configuration-dynamic.make) - -ifdef libfrontend_elements_installed - -ifeq ($(libfrontend_elements_installed),y) - -$(call export,l: -lfrontend-elements -lcult,cpp_options: ) - -else - -# Include export stub. -# -$(call include,$(scf_root)/export/libfrontend-elements/stub.make) - -endif - -else - -.NOTPARALLEL: - -endif diff --git a/libxsd-frontend/build/import/libxerces-c/configuration-rules.make b/libxsd-frontend/build/import/libxerces-c/configuration-rules.make index fdb2263..995e6bd 100644 --- a/libxsd-frontend/build/import/libxerces-c/configuration-rules.make +++ b/libxsd-frontend/build/import/libxerces-c/configuration-rules.make @@ -1,5 +1,4 @@ # file : build/import/libxerces-c/configuration-rules.make -# author : Boris Kolpackov # copyright : Copyright (c) 2005-2009 Boris Kolpackov # license : GNU GPL v2; see accompanying LICENSE file diff --git a/libxsd-frontend/build/import/libxerces-c/configure b/libxsd-frontend/build/import/libxerces-c/configure index 26e56a7..45cd3da 100755 --- a/libxsd-frontend/build/import/libxerces-c/configure +++ b/libxsd-frontend/build/import/libxerces-c/configure @@ -1,7 +1,6 @@ #! /usr/bin/env bash # file : build/import/libxerces-c/configure -# author : Boris Kolpackov # copyright : Copyright (c) 2005-2009 Boris Kolpackov # license : GNU GPL v2; see accompanying LICENSE file diff --git a/libxsd-frontend/build/import/libxerces-c/rules.make b/libxsd-frontend/build/import/libxerces-c/rules.make index 7cdca8c..21ac145 100644 --- a/libxsd-frontend/build/import/libxerces-c/rules.make +++ b/libxsd-frontend/build/import/libxerces-c/rules.make @@ -1,5 +1,4 @@ # file : build/import/libxerces-c/rules.make -# author : Boris Kolpackov # copyright : Copyright (c) 2005-2009 Boris Kolpackov # license : GNU GPL v2; see accompanying LICENSE file diff --git a/libxsd-frontend/build/import/libxerces-c/stub.make b/libxsd-frontend/build/import/libxerces-c/stub.make index d4de5ec..745200d 100644 --- a/libxsd-frontend/build/import/libxerces-c/stub.make +++ b/libxsd-frontend/build/import/libxerces-c/stub.make @@ -1,5 +1,4 @@ # file : build/import/libxerces-c/stub.make -# author : Boris Kolpackov # copyright : Copyright (c) 2005-2009 Boris Kolpackov # license : GNU GPL v2; see accompanying LICENSE file diff --git a/libxsd-frontend/build/import/libxsd-frontend/configuration-rules.make b/libxsd-frontend/build/import/libxsd-frontend/configuration-rules.make index 29e8083..05a312a 100644 --- a/libxsd-frontend/build/import/libxsd-frontend/configuration-rules.make +++ b/libxsd-frontend/build/import/libxsd-frontend/configuration-rules.make @@ -1,6 +1,5 @@ # file : build/import/libxsd-frontend/configuration-rules.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file $(dcf_root)/import/libxsd-frontend/configuration-dynamic.make: | $(dcf_root)/import/libxsd-frontend/. diff --git a/libxsd-frontend/build/import/libxsd-frontend/configure b/libxsd-frontend/build/import/libxsd-frontend/configure index cc6881c..0c34062 100755 --- a/libxsd-frontend/build/import/libxsd-frontend/configure +++ b/libxsd-frontend/build/import/libxsd-frontend/configure @@ -1,8 +1,7 @@ #! /usr/bin/env bash # file : build/import/libxsd-frontend/configure -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file diff --git a/libxsd-frontend/build/import/libxsd-frontend/stub.make b/libxsd-frontend/build/import/libxsd-frontend/stub.make index 3721928..cb57cef 100644 --- a/libxsd-frontend/build/import/libxsd-frontend/stub.make +++ b/libxsd-frontend/build/import/libxsd-frontend/stub.make @@ -1,6 +1,5 @@ # file : build/import/libxsd-frontend/stub.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file $(call include-once,$(scf_root)/import/libxsd-frontend/configuration-rules.make,$(dcf_root)) @@ -13,7 +12,7 @@ ifdef libxsd_frontend_installed ifeq ($(libxsd_frontend_installed),y) -$(call export,l: -lxsd-frontend -lfrontend-elements -lcult -lboost_filesystem -lxerces-c,cpp_options: ) +$(call export,l: -lxsd-frontend -lcutl -lxerces-c,cpp_options: ) else diff --git a/libxsd-frontend/build/ld/configuration-lib-dynamic.make b/libxsd-frontend/build/ld/configuration-lib-dynamic.make index 74c8885..63d2ed3 100644 --- a/libxsd-frontend/build/ld/configuration-lib-dynamic.make +++ b/libxsd-frontend/build/ld/configuration-lib-dynamic.make @@ -1,12 +1,12 @@ ld_lib_type := archive -ifneq ($(AR),) +ifeq ($(filter $(origin AR),undefined default),) ld_lib_ar := $(AR) else ld_lib_ar := ar endif -ifneq ($(RANLIB),) +ifeq ($(filter $(origin RANLIB),undefined default),) ld_lib_ranlib := $(RANLIB) else ld_lib_ranlib := ranlib diff --git a/libxsd-frontend/makefile b/libxsd-frontend/makefile index de97507..b92bfdf 100644 --- a/libxsd-frontend/makefile +++ b/libxsd-frontend/makefile @@ -1,6 +1,5 @@ # file : makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make diff --git a/libxsd-frontend/tests/dump/driver.cxx b/libxsd-frontend/tests/dump/driver.cxx index 5217ebf..dd925a9 100644 --- a/libxsd-frontend/tests/dump/driver.cxx +++ b/libxsd-frontend/tests/dump/driver.cxx @@ -1,10 +1,8 @@ // file : tests/dump/driver.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include - +#include #include #include #include @@ -14,19 +12,15 @@ #include -using namespace Cult::Types; +using namespace std; using namespace XSDFrontend; -using std::wcerr; -using std::wcout; -using std::endl; - -UnsignedLong indent = 0; +static unsigned long indent; std::wostream& ind (std::wostream& os) { - for (UnsignedLong n (0); n < indent; ++n) + for (unsigned long n (0); n < indent; ++n) os << L" "; return os; @@ -34,8 +28,6 @@ ind (std::wostream& os) namespace { - typedef Cult::Types::WideString String; - // Nameable which is named in the namespace scope. // String @@ -48,7 +40,7 @@ namespace struct List: Traversal::List { - virtual Void + virtual void traverse (Type& l) { if (l.annotated_p ()) @@ -78,7 +70,7 @@ namespace struct Union: Traversal::Union { - virtual Void + virtual void traverse (Type& u) { if (u.annotated_p ()) @@ -114,7 +106,7 @@ namespace struct Enumerator: Traversal::Enumerator { - virtual Void + virtual void traverse (Type& e) { if (e.annotated_p ()) @@ -127,7 +119,7 @@ namespace struct Enumeration: Traversal::Enumeration { - virtual Void + virtual void traverse (Type& e) { if (e.annotated_p ()) @@ -149,7 +141,7 @@ namespace struct ContainsParticle: Traversal::ContainsParticle { - virtual Void + virtual void traverse (Type& cp) { wcout << ind << "[" << cp.min () << ", "; @@ -165,7 +157,7 @@ namespace struct ContainsCompositor: Traversal::ContainsCompositor { - virtual Void + virtual void traverse (Type& cc) { wcout << ind << "[" << cc.min () << ", "; @@ -183,7 +175,7 @@ namespace Traversal::Choice, Traversal::Sequence { - virtual Void + virtual void traverse (SemanticGraph::All& a) { wcout << "all" << endl @@ -198,7 +190,7 @@ namespace wcout << ind << "}" << endl; } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { wcout << "choice" << endl @@ -213,7 +205,7 @@ namespace wcout << ind << "}" << endl; } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { wcout << "sequence" << endl @@ -231,7 +223,7 @@ namespace struct Attribute: Traversal::Attribute { - virtual Void + virtual void traverse (Type& a) { if (a.annotated_p ()) @@ -266,7 +258,7 @@ namespace struct AnyAttribute: Traversal::AnyAttribute { - virtual Void + virtual void traverse (Type& a) { if (a.annotated_p ()) @@ -279,7 +271,7 @@ namespace struct Element: Traversal::Element { - virtual Void + virtual void traverse (Type& e) { wcout << "element " << e.name (); @@ -309,7 +301,7 @@ namespace struct ElementFlat: Traversal::Element { - virtual Void + virtual void traverse (Type& e) { if (e.annotated_p ()) @@ -329,7 +321,7 @@ namespace struct Any: Traversal::Any { - virtual Void + virtual void traverse (Type& a) { wcout << "any '" << a.name () << "'" << endl; @@ -338,7 +330,7 @@ namespace struct AnyFlat: Traversal::Any { - virtual Void + virtual void traverse (Type& a) { if (a.annotated_p ()) @@ -351,7 +343,7 @@ namespace struct Complex: Traversal::Complex { - virtual Void + virtual void traverse (Type& c) { // Anonymous type definition can recursively refer to itself. @@ -389,7 +381,7 @@ namespace struct GlobalAttribute: Traversal::Attribute { - virtual Void + virtual void traverse (Type& a) { if (a.annotated_p ()) @@ -423,7 +415,7 @@ namespace struct GlobalElement: Traversal::Element { - virtual Void + virtual void traverse (Type& e) { if (e.annotated_p ()) @@ -457,7 +449,7 @@ namespace struct Namespace: Traversal::Namespace { - virtual Void + virtual void traverse (Type& n) { wcout << ind << "namespace " << n.name () << endl @@ -477,21 +469,21 @@ namespace Traversal::Sources //Traversal::Implies @@ Need a --with-implies option { - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { if (traverse_uses (i, "imports")) Traversal::Imports::traverse (i); } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { if (traverse_uses (i, "includes")) Traversal::Includes::traverse (i); } - virtual Void + virtual void traverse (SemanticGraph::Sources& s) { if (traverse_uses (s, "sources")) @@ -499,7 +491,7 @@ namespace } /* - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { if (traverse_uses (i, "implies")) @@ -507,7 +499,7 @@ namespace } */ - Boolean + bool traverse_uses (SemanticGraph::Uses& u, String const& type) { SemanticGraph::Schema& s (u.schema ()); @@ -531,7 +523,7 @@ namespace struct Schema: Traversal::Schema { - virtual Void + virtual void traverse (Type& s) { wcout << ind << "{" << endl; @@ -545,20 +537,19 @@ namespace struct AnonymousNameTranslator: Transformations::AnonymousNameTranslator { - virtual WideString - translate (WideString const& /*file*/, - WideString const& ns, - WideString const& name, - WideString const& xpath) + virtual String + translate (String const& /*file*/, + String const& ns, + String const& name, + String const& xpath) { wcout << "anonymous: " << ns << " " << name << " " << xpath << endl; return name; } }; - -Int -main (Int argc, Char* argv[]) +int +main (int argc, char* argv[]) { try { @@ -570,9 +561,9 @@ main (Int argc, Char* argv[]) // Parse options. // - Int i (1); - Boolean anon (false); - Boolean enum_synth (false); + int i (1); + bool anon (false); + bool enum_synth (false); for (; i < argc; ++i) { @@ -586,10 +577,10 @@ main (Int argc, Char* argv[]) // Parse schema. // - SemanticGraph::Path path (argv[i], boost::filesystem::native); + SemanticGraph::Path path (argv[i]); Parser parser (true, false, true); - Evptr tu (parser.parse (path)); + auto_ptr tu (parser.parse (path)); // // diff --git a/libxsd-frontend/tests/dump/makefile b/libxsd-frontend/tests/dump/makefile index c51e72e..707c9cc 100644 --- a/libxsd-frontend/tests/dump/makefile +++ b/libxsd-frontend/tests/dump/makefile @@ -1,6 +1,5 @@ # file : tests/dump/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make diff --git a/libxsd-frontend/tests/makefile b/libxsd-frontend/tests/makefile index 6b794d6..7ed5300 100644 --- a/libxsd-frontend/tests/makefile +++ b/libxsd-frontend/tests/makefile @@ -1,6 +1,5 @@ # file : tests/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/annotation/makefile b/libxsd-frontend/tests/schema/annotation/makefile index 97f578b..7705ba8 100644 --- a/libxsd-frontend/tests/schema/annotation/makefile +++ b/libxsd-frontend/tests/schema/annotation/makefile @@ -1,6 +1,5 @@ # file : tests/schema/annotation/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/anonymous/makefile b/libxsd-frontend/tests/schema/anonymous/makefile index 950e34b..5d2cfe2 100644 --- a/libxsd-frontend/tests/schema/anonymous/makefile +++ b/libxsd-frontend/tests/schema/anonymous/makefile @@ -1,6 +1,5 @@ # file : tests/schema/annotation/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/attribute-group/makefile b/libxsd-frontend/tests/schema/attribute-group/makefile index e96c0c7..00746a3 100644 --- a/libxsd-frontend/tests/schema/attribute-group/makefile +++ b/libxsd-frontend/tests/schema/attribute-group/makefile @@ -1,6 +1,5 @@ # file : tests/schema/attribute-group/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/default/makefile b/libxsd-frontend/tests/schema/default/makefile index dbb5fa9..d2ab540 100644 --- a/libxsd-frontend/tests/schema/default/makefile +++ b/libxsd-frontend/tests/schema/default/makefile @@ -1,6 +1,5 @@ # file : tests/schema/default/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/element-group/makefile b/libxsd-frontend/tests/schema/element-group/makefile index 8a4ad89..3271b94 100644 --- a/libxsd-frontend/tests/schema/element-group/makefile +++ b/libxsd-frontend/tests/schema/element-group/makefile @@ -1,6 +1,5 @@ # file : tests/schema/element-group/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/enumeration/makefile b/libxsd-frontend/tests/schema/enumeration/makefile index d958178..bd55e0f 100644 --- a/libxsd-frontend/tests/schema/enumeration/makefile +++ b/libxsd-frontend/tests/schema/enumeration/makefile @@ -1,6 +1,5 @@ # file : tests/schema/enumeration/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/makefile b/libxsd-frontend/tests/schema/makefile index fde5482..3a6d048 100644 --- a/libxsd-frontend/tests/schema/makefile +++ b/libxsd-frontend/tests/schema/makefile @@ -1,6 +1,5 @@ # file : tests/schema -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make diff --git a/libxsd-frontend/tests/schema/union/makefile b/libxsd-frontend/tests/schema/union/makefile index 7f01070..b0a83e3 100644 --- a/libxsd-frontend/tests/schema/union/makefile +++ b/libxsd-frontend/tests/schema/union/makefile @@ -1,6 +1,5 @@ # file : tests/schema/union/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make diff --git a/libxsd-frontend/version b/libxsd-frontend/version index 092afa1..227cea2 100644 --- a/libxsd-frontend/version +++ b/libxsd-frontend/version @@ -1 +1 @@ -1.17.0 +2.0.0 diff --git a/libxsd-frontend/xsd-frontend/generators/dependencies.cxx b/libxsd-frontend/xsd-frontend/generators/dependencies.cxx new file mode 100644 index 0000000..55e7ae8 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/generators/dependencies.cxx @@ -0,0 +1,70 @@ +// file : xsd-frontend/generators/dependencies.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include +#include + +#include + +namespace XSDFrontend +{ + typedef std::vector Paths; + + namespace + { + // Go into included/imported (but not implied) schemas while making + // sure we don't process the same stuff more than once. + // + struct Uses: Traversal::Uses + { + Uses (Paths& p): paths_ (p) {} + + virtual void + traverse (Type& u) + { + if (u.is_a ()) + return; + + SemanticGraph::Schema& s (u.schema ()); + + if (!s.context ().count ("xsd-frontend-dependencies-seen")) + { + s.context ().set ("xsd-frontend-dependencies-seen", true); + + // While the edge contains the exact path that was found in the + // schema, the schema node itself has the reative to the including + // or importing schema path, which is what we want. + // + paths_.push_back (s.file ()); + Traversal::Uses::traverse (u); + } + } + + private: + Paths& paths_; + }; + } + + namespace Generators + { + Paths Dependencies:: + generate (SemanticGraph::Schema& s, SemanticGraph::Path const& p) + { + Paths r; + r.push_back (p); + + Traversal::Schema schema; + Uses uses (r); + + schema >> uses >> schema; + + // Some twisted schemas do recusive inclusions. + // + s.context ().set ("xsd-frontend-dependencies-seen", true); + + schema.dispatch (s); + return r; + } + } +} diff --git a/libxsd-frontend/xsd-frontend/generators/dependencies.hxx b/libxsd-frontend/xsd-frontend/generators/dependencies.hxx new file mode 100644 index 0000000..5a7624f --- /dev/null +++ b/libxsd-frontend/xsd-frontend/generators/dependencies.hxx @@ -0,0 +1,32 @@ +// file : xsd-frontend/generators/dependencies.hxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_GENERATORS_DEPENDENCIES_HXX +#define XSD_FRONTEND_GENERATORS_DEPENDENCIES_HXX + +#include + +#include + +#include // Path +#include + +namespace XSDFrontend +{ + namespace Generators + { + // Return the list of included/imported schema paths (transitively and + // including the main schema file) which can then be used to produce + // make dependencies, etc. + // + class Dependencies + { + public: + std::vector + generate (SemanticGraph::Schema&, SemanticGraph::Path const&); + }; + } +} + +#endif // XSD_FRONTEND_GENERATORS_DEPENDENCIES_HXX diff --git a/libxsd-frontend/xsd-frontend/makefile b/libxsd-frontend/xsd-frontend/makefile index abf6565..4dbffcd 100644 --- a/libxsd-frontend/xsd-frontend/makefile +++ b/libxsd-frontend/xsd-frontend/makefile @@ -1,6 +1,5 @@ # file : xsd-frontend/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make @@ -44,7 +43,9 @@ cxx_tun += transformations/anonymous.cxx \ transformations/schema-per-type.cxx \ transformations/simplifier.cxx -cxx_tun += parser.cxx schema-dom-parser.cxx +cxx_tun += generators/dependencies.cxx + +cxx_tun += types.cxx parser.cxx schema-dom-parser.cxx cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) @@ -57,34 +58,21 @@ xsd_frontend.l.cpp-options := $(out_base)/xsd-frontend.l.cpp-options clean := $(out_base)/.clean -# Import. -# -$(call import,\ - $(scf_root)/import/libboost/filesystem/stub.make,\ - l: fs.l,cpp-options: fs.l.cpp-options) - $(call import,\ $(scf_root)/import/libxerces-c/stub.make,\ l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) $(call import,\ - $(scf_root)/import/libcult/stub.make,\ - l: cult.l,cpp-options: cult.l.cpp-options) + $(scf_root)/import/libcutl/stub.make,\ + l: cutl.l,cpp-options: cutl.l.cpp-options) -$(call import,\ - $(scf_root)/import/libfrontend-elements/stub.make,\ - l: fe.l,cpp-options: fe.l.cpp-options) - -# what to build +# What to build. # -$(xsd_frontend.l): $(cxx_obj) $(fe.l) $(cult.l) $(xerces_c.l) $(fs.l) +$(xsd_frontend.l): $(cxx_obj) $(cutl.l) $(xerces_c.l) $(xsd_frontend.l.cpp-options): prefix := xsd-frontend/ $(out_root)/ $(xsd_frontend.l.cpp-options): value := -I$(src_root) -I$(out_root) -$(xsd_frontend.l.cpp-options): \ - $(fs.l.cpp-options) \ - $(fe.l.cpp-options) \ - $(cult.l.cpp-options) +$(xsd_frontend.l.cpp-options): $(cutl.l.cpp-options) #@@ This can be further optimized since only parser depends on xerces. # @@ -104,8 +92,11 @@ $(out_base)/: $(xsd_frontend.l) $(clean): $(xsd_frontend.l).o.clean \ $(xsd_frontend.l.cpp-options).clean \ $(addsuffix .cxx.clean,$(cxx_obj)) \ - $(addsuffix .cxx.clean,$(cxx_od)) \ - $(addsuffix .m4.clean,$(m4_cxx)) + $(addsuffix .cxx.clean,$(cxx_od)) + +ifneq ($(libxsd_frontend_clean_gen),n) +$(clean): $(addsuffix .m4.clean,$(m4_cxx)) +endif # Generated .gitignore. # diff --git a/libxsd-frontend/xsd-frontend/parser.cxx b/libxsd-frontend/xsd-frontend/parser.cxx index 901a8d3..6b582ab 100644 --- a/libxsd-frontend/xsd-frontend/parser.cxx +++ b/libxsd-frontend/xsd-frontend/parser.cxx @@ -1,21 +1,23 @@ // file : xsd-frontend/parser.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include -#include +#include +#include +#include +#include +#include + +#include + +#include // Check Xerces-C++ version. #include +#include #include #include #include -#include -#include -#include -#include - //@@ Do i need this? // #include @@ -38,15 +40,9 @@ #include #include -#include -#include -#include // std::auto_ptr - -using std::wcout; -using std::wcerr; -using std::endl; +using namespace std; -using Cult::RTTI::TypeId; +using cutl::compiler::type_id; namespace XSDFrontend { @@ -55,7 +51,7 @@ namespace XSDFrontend //@@ Port to tracing facility. // - Boolean trace_ = false; + bool trace_ = false; String const xsd = L"http://www.w3.org/2001/XMLSchema"; String const xse = L"http://www.codesynthesis.com/xmlns/xml-schema-extension"; @@ -107,6 +103,43 @@ namespace XSDFrontend String name_; }; + // Trim leading and trailing whitespaces. + // + template + StringTemplate + trim (StringTemplate const& s) + { + typedef StringTemplate String; + + size_t size (s.size ()); + + if (size == 0) + return s; + + C const* f (s.c_str ()); + C const* l (f + size); + + C const* of (f); + + while (f < l && + (*f == C (0x20) || *f == C (0x0A) || + *f == C (0x0D) || *f == C (0x09))) + ++f; + + --l; + + C const* ol (l); + + while (l > f && + (*l == C (0x20) || *l == C (0x0A) || + *l == C (0x0D) || *l == C (0x09))) + --l; + + if (f != of || l != ol) + return f <= l ? String (f, l - f + 1) : String (); + else + return s; + } // Name cache. We only support maximum two nodes with the same // name in the cache (e.g., element and type). For (rare) cases @@ -120,9 +153,9 @@ namespace XSDFrontend Nameable* second; }; - typedef Cult::Containers::Map NodeMap; - typedef Cult::Containers::Map NamespaceMap; - typedef Cult::Containers::Vector DefaultValues; + typedef std::map NodeMap; + typedef std::map NamespaceMap; + typedef std::vector DefaultValues; template X& @@ -133,11 +166,11 @@ namespace XSDFrontend { // First check the cache. // - NamespaceMap::Iterator i (cache.find (ns_name)); + NamespaceMap::iterator i (cache.find (ns_name)); if (i != cache.end ()) { - NodeMap::Iterator j (i->second.find (uq_name)); + NodeMap::iterator j (i->second.find (uq_name)); if (j != i->second.end ()) { @@ -188,12 +221,12 @@ namespace XSDFrontend // // - typedef Cult::Containers::Map Facets; + typedef std::map Facets; - Void + void copy_facets (Restricts& r, Facets const& f) { - for (Facets::ConstIterator i (f.begin ()), e (f.end ()); i != e; ++i) + for (Facets::const_iterator i (f.begin ()), e (f.end ()); i != e; ++i) r.facet_insert (i->first, i->second); } @@ -210,14 +243,14 @@ namespace XSDFrontend String uq_name; }; - typedef Cult::Containers::Vector UnionMemberTypes; + typedef std::vector UnionMemberTypes; // // struct ElementGroupRef { ElementGroupRef (String const& uq_name_, String const& ns_name_, - UnsignedLong min_, UnsignedLong max_, + unsigned long min_, unsigned long max_, Compositor& compositor, Scope& scope) : uq_name (uq_name_), ns_name (ns_name_), min (min_), max (max_) @@ -232,7 +265,7 @@ namespace XSDFrontend } ElementGroupRef (String const& uq_name_, String const& ns_name_, - UnsignedLong min_, UnsignedLong max_, + unsigned long min_, unsigned long max_, Scope& scope) : uq_name (uq_name_), ns_name (ns_name_), min (min_), max (max_) @@ -244,13 +277,12 @@ namespace XSDFrontend String uq_name; String ns_name; - UnsignedLong min, max; + unsigned long min, max; Compositor::ContainsIterator contains_pos; Scope::NamesIterator names_pos; }; - typedef Cult::Containers::Vector ElementGroupRefs; - + typedef std::vector ElementGroupRefs; // // @@ -271,7 +303,7 @@ namespace XSDFrontend Scope::NamesIterator names_pos; }; - typedef Cult::Containers::Vector AttributeGroupRefs; + typedef std::vector AttributeGroupRefs; // @@ -290,14 +322,14 @@ namespace XSDFrontend } template - Void + void add_edge_left (E& e) { node_.add_edge_left (e, arg_); } template - Void + void add_edge_right (E& e) { node_.add_edge_right (e, arg_); @@ -324,7 +356,7 @@ namespace XSDFrontend Traversal::Compositor { Resolver (Schema& s, - Boolean& valid, + bool& valid, NamespaceMap& cache, DefaultValues& default_values) : s_ (s), @@ -335,7 +367,7 @@ namespace XSDFrontend *this >> contains_compositor >> *this; } - Void + void traverse (SemanticGraph::Attribute& a) { // Avoid traversing attribute more than once. @@ -348,13 +380,13 @@ namespace XSDFrontend } } - Void + void traverse (SemanticGraph::Element& e) { resolve_element (e); } - Void + void resolve_element (SemanticGraph::Element& e) { // Avoid resolving element more than once. @@ -383,6 +415,15 @@ namespace XSDFrontend resolve (ns_name, uq_name, s_, cache_)); s_.new_edge (e, root); + + // See if we need to derive the type of this element from the + // one it substitutes. + // + if (!e.typed_p ()) + { + resolve_member (root); // Make sure the type is resolved. + s_.new_edge (e, root.type ()); + } } catch (NotNamespace const& ex) { @@ -405,7 +446,7 @@ namespace XSDFrontend } } - Void + void resolve_member (SemanticGraph::Member& m) { using SemanticGraph::Member; @@ -437,8 +478,15 @@ namespace XSDFrontend m.context ().remove ("instance-ns-name"); m.context ().remove ("instance-uq-name"); - - Member& ref (resolve (ns_name, uq_name, s_, cache_)); + // Resolve the name to the same type. It is legal to have + // an element and an attribute with the same name. + // + Member& ref ( + m.is_a () + ? static_cast ( + resolve (ns_name, uq_name, s_, cache_)) + : static_cast ( + resolve (ns_name, uq_name, s_, cache_))); // Make sure the referenced member is fully resolved. // @@ Substitutes edge won't be resolved. @@ -509,19 +557,10 @@ namespace XSDFrontend if (!m.annotated_p () && ref.annotated_p ()) s_.new_edge (ref.annotation (), m); - // Type info. + // Type info. Can be missing for a substitution group member. // if (ref.typed_p ()) s_.new_edge (m, ref.type ()); - else - { - if (valid_) - { - wcerr << "ice: referenced instance '" << ns_name << "#" - << uq_name << "' is not typed" << endl; - abort (); - } - } } } catch (NotNamespace const& ex) @@ -544,19 +583,19 @@ namespace XSDFrontend } } - Void + void traverse (SemanticGraph::Fundamental::IdRef& i) { ref_type (i); } - Void + void traverse (SemanticGraph::Fundamental::IdRefs& i) { ref_type (i); } - Void + void ref_type (SemanticGraph::Specialization& s) { if (s.context ().count ("type-ns-name")) @@ -584,7 +623,7 @@ namespace XSDFrontend } } - Void + void traverse (SemanticGraph::List& l) { if (l.context ().count ("type-ns-name")) @@ -614,7 +653,7 @@ namespace XSDFrontend Traversal::List::traverse (l); } - Void + void traverse (SemanticGraph::Union& u) { using SemanticGraph::Union; @@ -627,7 +666,7 @@ namespace XSDFrontend // Process it backwards so that we can just insert each // edge in the front. // - for (UnionMemberTypes::ConstReverseIterator i (m.rbegin ()); + for (UnionMemberTypes::const_reverse_iterator i (m.rbegin ()); i != m.rend (); i++) { try @@ -655,7 +694,7 @@ namespace XSDFrontend Traversal::Union::traverse (u); } - Void + void traverse (SemanticGraph::Complex& c) { // Avoid traversing complex type more than once. @@ -669,11 +708,9 @@ namespace XSDFrontend // if (c.context ().count ("type-ns-name")) { - using Cult::RTTI::TypeId; - String ns_name (c.context ().get ("type-ns-name")); String uq_name (c.context ().get ("type-uq-name")); - TypeId edge_id (c.context ().get ("edge-type-id")); + type_id edge_id (c.context ().get ("edge-type-id")); c.context ().remove ("type-ns-name"); c.context ().remove ("type-uq-name"); @@ -725,7 +762,7 @@ namespace XSDFrontend // Handle refs from last to first so that multiple insertions // to an empty list (always front) end up in proper order. // - for (AttributeGroupRefs::ReverseIterator i (refs.rbegin ()); + for (AttributeGroupRefs::reverse_iterator i (refs.rbegin ()); i != refs.rend (); ++i) { clone_attribute_group_content (*i, c); @@ -756,7 +793,7 @@ namespace XSDFrontend Traversal::Complex::traverse (c); } - Void + void traverse (SemanticGraph::Enumeration& e) { // Resolve base type if any. @@ -797,7 +834,7 @@ namespace XSDFrontend Traversal::Enumeration::traverse (e); } - Void + void traverse (SemanticGraph::ElementGroup& g) { // Avoid traversing groups more than once. @@ -818,7 +855,7 @@ namespace XSDFrontend // We need a "shallow" resolve to break possible recursing: // group->element->complexType->group. // - Void + void resolve_element_group (SemanticGraph::ElementGroup& g) { using SemanticGraph::Scope; @@ -841,7 +878,7 @@ namespace XSDFrontend } } - Void + void traverse (SemanticGraph::AttributeGroup& g) { // Avoid traversing groups more than once. @@ -861,7 +898,7 @@ namespace XSDFrontend // Handle refs from last to first so that multiple insertions // to an empty list (always front) end up in proper order. // - for (AttributeGroupRefs::ReverseIterator i (refs.rbegin ()); + for (AttributeGroupRefs::reverse_iterator i (refs.rbegin ()); i != refs.rend (); ++i) { clone_attribute_group_content (*i, g); @@ -873,7 +910,7 @@ namespace XSDFrontend Traversal::AttributeGroup::traverse (g); } - Void + void traverse (SemanticGraph::Compositor& c) { using SemanticGraph::Compositor; @@ -890,7 +927,7 @@ namespace XSDFrontend // Handle refs from last to first so that multiple insertions // to an empty list (always front) end up in proper order. // - for (ElementGroupRefs::ReverseIterator i (refs.rbegin ()); + for (ElementGroupRefs::reverse_iterator i (refs.rbegin ()); i != refs.rend (); ++i) { // Find our scope. @@ -1051,8 +1088,8 @@ namespace XSDFrontend // order to put it into the scope. Note that we cannot reuse // the name from the prototype. - UnsignedLong count; - FrontendElements::Context& ctx (scope.context ()); + unsigned long count; + SemanticGraph::Context& ctx (scope.context ()); if (!ctx.count ("any-name-count")) { @@ -1060,9 +1097,9 @@ namespace XSDFrontend ctx.set ("any-name-count", count); } else - count = ++(ctx.get ("any-name-count")); + count = ++(ctx.get ("any-name-count")); - std::basic_ostringstream os; + std::basic_ostringstream os; os << "any #" << count; NodeArgs na (scope, pos); @@ -1126,7 +1163,7 @@ namespace XSDFrontend return copy; } - Void + void clone_attribute_group_content (AttributeGroupRef& ref, SemanticGraph::Scope& s) { @@ -1213,8 +1250,8 @@ namespace XSDFrontend // one in order to put it into the scope. Note that we cannot // reuse the name from the attribute group. - UnsignedLong count; - FrontendElements::Context& ctx (s.context ()); + unsigned long count; + SemanticGraph::Context& ctx (s.context ()); if (!ctx.count ("any-attribute-name-count")) { @@ -1222,9 +1259,9 @@ namespace XSDFrontend ctx.set ("any-attribute-name-count", count); } else - count = ++(ctx.get ("any-attribute-name-count")); + count = ++(ctx.get ("any-attribute-name-count")); - std::basic_ostringstream os; + std::basic_ostringstream os; os << "any-attribute #" << count; NodeArgs na (s, pos); @@ -1256,7 +1293,7 @@ namespace XSDFrontend private: Schema& s_; - Boolean& valid_; + bool& valid_; NamespaceMap& cache_; DefaultValues& default_values_; @@ -1266,67 +1303,54 @@ namespace XSDFrontend }; } - // - // - struct FilePathComparator - { - Boolean - operator () (SemanticGraph::Path const& x, - SemanticGraph::Path const& y) const - { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - return x.native_file_string () < y.native_file_string (); -#else - return x.string () < y.string (); -#endif - } - }; - // Parser::Impl // - class Parser::Impl: public NonCopyable + class Parser::Impl { + Impl (Impl const&); + Impl& operator= (Impl const&); + public: ~Impl (); - Impl (Boolean proper_restriction, - Boolean multiple_imports, - Boolean full_schema_check, + Impl (bool proper_restriction, + bool multiple_imports, + bool full_schema_check, LocationTranslator*, const WarningSet*); - Evptr + auto_ptr parse (Path const&); - Evptr + auto_ptr parse (Paths const&); - Evptr + auto_ptr xml_schema (Path const&); private: - Void + void fill_xml_schema (Schema&, Path const&); private: XML::AutoPtr - dom (SemanticGraph::Path const&, Boolean validate); + dom (SemanticGraph::Path const&, bool validate); - Void + void schema (XML::Element const&); SemanticGraph::Annotation* - annotation (Boolean process); + annotation (bool process); - Void + void import (XML::Element const&); - Void + void include (XML::Element const&); - Void - element_group (XML::Element const&, Boolean in_compositor); + void + element_group (XML::Element const&, bool in_compositor); SemanticGraph::Type* simple_type (XML::Element const&); @@ -1340,7 +1364,7 @@ namespace XSDFrontend SemanticGraph::Type* restriction (XML::Element const& r, XML::Element const& type); - Void + void enumeration (XML::Element const&); SemanticGraph::Type* @@ -1350,47 +1374,47 @@ namespace XSDFrontend all (XML::Element const&); Choice* - choice (XML::Element const&, Boolean in_compositor); + choice (XML::Element const&, bool in_compositor); Sequence* - sequence (XML::Element const&, Boolean in_compositor); + sequence (XML::Element const&, bool in_compositor); - Void + void simple_content (XML::Element const&); - Void + void complex_content (XML::Element const&, Complex&); - Void + void simple_content_extension (XML::Element const&); - Void + void simple_content_restriction (XML::Element const&); - Void + void complex_content_extension (XML::Element const&, Complex&); - Void + void complex_content_restriction (XML::Element const&, Complex&); - Void - element (XML::Element const&, Boolean global); + void + element (XML::Element const&, bool global); - Void - attribute (XML::Element const&, Boolean global); + void + attribute (XML::Element const&, bool global); - Void + void attribute_group (XML::Element const&); - Void + void any (XML::Element const&); - Void + void any_attribute (XML::Element const&); private: - Boolean - is_disabled (Char const* warning) + bool + is_disabled (char const* warning) { return disabled_warnings_all_ || (disabled_warnings_ && @@ -1398,10 +1422,10 @@ namespace XSDFrontend } private: - Boolean + bool more () const { - Iterator const& it (iteration_state_.top ()); + iterator const& it (iteration_state_.top ()); return it.l_->getLength () > it.i_; } @@ -1409,41 +1433,41 @@ namespace XSDFrontend XML::Element next () { - Iterator& it (iteration_state_.top ()); + iterator& it (iteration_state_.top ()); return XML::Element ( dynamic_cast (it.l_->item (it.i_++))); } - Void + void prev () { - Iterator& it (iteration_state_.top ()); + iterator& it (iteration_state_.top ()); if (it.i_) --it.i_; } - Void + void push (XML::Element const& e) { iteration_state_.push (e.dom_element ()); } - Void + void pop () { iteration_state_.pop (); } private: - Void + void push_scope (SemanticGraph::Scope& s) { scope_stack_.push (&s); } - Void + void pop_scope () { scope_stack_.pop (); @@ -1456,13 +1480,13 @@ namespace XSDFrontend } private: - Void + void push_compositor (SemanticGraph::Compositor& c) { compositor_stack_.push (&c); } - Void + void pop_compositor () { assert (!compositor_stack_.empty ()); @@ -1477,30 +1501,32 @@ namespace XSDFrontend } private: - UnsignedLong + static unsigned long const unbounded = ~static_cast (0); + + unsigned long parse_min (String const& m) { if (m.empty ()) return 1; - UnsignedLong v; - std::basic_istringstream is (m); + unsigned long v; + std::basic_istringstream is (m); is >> v; return v; } - UnsignedLong + unsigned long parse_max (String const& m) { if (m.empty ()) return 1; if (m == L"unbounded") - return 0; + return unbounded; - UnsignedLong v; - std::basic_istringstream is (m); + unsigned long v; + std::basic_istringstream is (m); is >> v; return v; @@ -1590,32 +1616,32 @@ namespace XSDFrontend private: XML::PtrVector* dom_docs_; - struct Iterator + struct iterator { - Iterator (Xerces::DOMElement* e) + iterator (Xerces::DOMElement* e) : l_ (e->getChildNodes ()), i_ (0) { } Xerces::DOMNodeList* l_; - Size i_; + size_t i_; }; - Cult::Containers::Stack iteration_state_; + std::stack iteration_state_; SemanticGraph::Schema* s_; // root schema file SemanticGraph::Schema* cur_; // current schema file - Boolean cur_chameleon_; // whethere cur_ is chameleon + bool cur_chameleon_; // whethere cur_ is chameleon SemanticGraph::Schema* xml_schema_; // XML Schema file SemanticGraph::Path xml_schema_path_; // // - Cult::Containers::Stack scope_stack_; + std::stack scope_stack_; // // - Cult::Containers::Stack compositor_stack_; + std::stack compositor_stack_; // Map of absolute file path and namespace pair to a Schema node. @@ -1628,18 +1654,10 @@ namespace XSDFrontend } - friend Boolean + friend bool operator< (SchemaId const& x, SchemaId const& y) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - return x.path_.native_file_string () < y.path_.native_file_string () - || (x.path_.native_file_string () == y.path_.native_file_string () - && x.ns_ < y.ns_); -#else - return x.path_.string () < y.path_.string () - || (x.path_.string () == y.path_.string () - && x.ns_ < y.ns_); -#endif + return x.path_ < y.path_ || (x.path_ == y.path_ && x.ns_ < y.ns_); } private: @@ -1648,20 +1666,33 @@ namespace XSDFrontend }; - typedef - Cult::Containers::Map - SchemaMap; - + typedef std::map SchemaMap; SchemaMap schema_map_; // Path stack for diagnostic. // - Cult::Containers::Stack file_stack_; + struct PathPair + { + PathPair (SemanticGraph::Path const& r, SemanticGraph::Path const& a) + : rel (r), abs (a) + { + } + + SemanticGraph::Path rel, abs; + }; + + std::stack file_stack_; SemanticGraph::Path const& file () { - return file_stack_.top (); + return file_stack_.top ().rel; + } + + SemanticGraph::Path const& + abs_file () + { + return file_stack_.top ().abs; } // Members with default/fixed values (needed for QName handling). @@ -1669,26 +1700,26 @@ namespace XSDFrontend DefaultValues default_values_; private: - Boolean qualify_attribute_; - Boolean qualify_element_; + bool qualify_attribute_; + bool qualify_element_; - Boolean valid_; + bool valid_; - Boolean proper_restriction_; - Boolean multiple_imports_; - Boolean full_schema_check_; + bool proper_restriction_; + bool multiple_imports_; + bool full_schema_check_; LocationTranslator* loc_translator_; const WarningSet* disabled_warnings_; - Boolean disabled_warnings_all_; + bool disabled_warnings_all_; NamespaceMap* cache_; }; Parser::Impl:: - Impl (Boolean proper_restriction, - Boolean multiple_imports, - Boolean full_schema_check, + Impl (bool proper_restriction, + bool multiple_imports, + bool full_schema_check, LocationTranslator* t, const WarningSet* dw) : s_ (0), @@ -1730,7 +1761,7 @@ namespace XSDFrontend return node; } - Void Parser::Impl:: + void Parser::Impl:: fill_xml_schema (Schema& s, Path const& path) { Namespace& ns (s.new_node (path, 1, 1)); @@ -1829,12 +1860,12 @@ namespace XSDFrontend } - Evptr Parser::Impl:: + auto_ptr Parser::Impl:: xml_schema (Path const& tu) { valid_ = true; - Evptr rs (new Schema (tu, 1, 1)); + auto_ptr rs (new Schema (tu, 1, 1)); fill_xml_schema (*rs, tu); if (!valid_) @@ -1842,7 +1873,7 @@ namespace XSDFrontend return rs; } - Evptr Parser::Impl:: + auto_ptr Parser::Impl:: parse (Path const& tu) { valid_ = true; @@ -1861,12 +1892,12 @@ namespace XSDFrontend throw InvalidSchema (); XML::Element root (d->getDocumentElement ()); - String ns (root["targetNamespace"]); + String ns (trim (root["targetNamespace"])); if (trace_) wcout << "target namespace: " << ns << endl; - Evptr rs (new Schema (tu, root.line (), root.column ())); + auto_ptr rs (new Schema (tu, root.line (), root.column ())); // Implied schema with fundamental types. // @@ -1878,16 +1909,18 @@ namespace XSDFrontend // Parse. // { - // Enter the file into schema_map_. + // Enter the file into schema_map_. Do normalize() before + // complete() to avoid hitting system path limits with '..' + // directories. // - Path abs_path (system_complete (tu)); - abs_path.normalize (); + Path abs_path (tu); + abs_path.normalize ().complete (); schema_map_[SchemaId (abs_path, ns)] = rs.get (); rs->context ().set ("absolute-path", abs_path); s_ = cur_ = rs.get (); { - file_stack_.push (tu); + file_stack_.push (PathPair (tu, abs_path)); { push_scope ( @@ -1919,7 +1952,7 @@ namespace XSDFrontend struct Uses: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { Schema& s (u.schema ()); @@ -1945,24 +1978,24 @@ namespace XSDFrontend Traversal::Element, Traversal::Member { - AnonymousMember (Traversal::NodeDispatcherBase& d) + AnonymousMember (Traversal::NodeDispatcher& d) { belongs_.node_traverser (d); } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { traverse_member (a); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { traverse_member (e); } - Void + void traverse_member (SemanticGraph::Member& m) { if (m.typed_p () && @@ -1983,12 +2016,12 @@ namespace XSDFrontend struct AnonymousBase: Traversal::Type { - AnonymousBase (Traversal::NodeDispatcherBase& d) + AnonymousBase (Traversal::NodeDispatcher& d) : base_ (d) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (!t.named_p ()) @@ -1996,7 +2029,7 @@ namespace XSDFrontend } private: - Traversal::NodeDispatcherBase& base_; + Traversal::NodeDispatcher& base_; } anonymous_base (resolver); ns_names >> resolver; @@ -2020,7 +2053,7 @@ namespace XSDFrontend // if (valid_) { - for (DefaultValues::ConstIterator i (default_values_.begin ()), + for (DefaultValues::const_iterator i (default_values_.begin ()), e (default_values_.end ()); i != e; ++i) { SemanticGraph::Member& m (**i); @@ -2068,7 +2101,7 @@ namespace XSDFrontend return rs; } - Evptr Parser::Impl:: + auto_ptr Parser::Impl:: parse (Paths const& paths) { valid_ = true; @@ -2081,7 +2114,7 @@ namespace XSDFrontend NamespaceMap cache; cache_ = &cache; - Evptr rs (new Schema ("", 0, 0)); + auto_ptr rs (new Schema (Path (), 0, 0)); // Implied schema with fundamental types. // @@ -2094,7 +2127,7 @@ namespace XSDFrontend // s_ = rs.get (); - for (Paths::ConstIterator i (paths.begin ()); i != paths.end (); ++i) + for (Paths::const_iterator i (paths.begin ()); i != paths.end (); ++i) { Path const& tu (*i); XML::AutoPtr d (dom (tu, true)); @@ -2103,15 +2136,17 @@ namespace XSDFrontend throw InvalidSchema (); XML::Element root (d->getDocumentElement ()); - String ns (root["targetNamespace"]); + String ns (trim (root["targetNamespace"])); if (trace_) wcout << "target namespace: " << ns << endl; - // Check if we already have this schema. + // Check if we already have this schema. Do normalize() before + // complete() to avoid hitting system path limits with '..' + // directories. // - Path abs_path (system_complete (tu)); - abs_path.normalize (); + Path abs_path (tu); + abs_path.normalize ().complete (); SchemaId schema_id (abs_path, ns); if (schema_map_.find (schema_id) != schema_map_.end ()) @@ -2129,7 +2164,7 @@ namespace XSDFrontend cur_ = &s; { - file_stack_.push (tu); + file_stack_.push (PathPair (tu, abs_path)); { push_scope ( @@ -2166,7 +2201,7 @@ namespace XSDFrontend struct Uses: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { Schema& s (u.schema ()); @@ -2192,24 +2227,24 @@ namespace XSDFrontend Traversal::Element, Traversal::Member { - AnonymousMember (Traversal::NodeDispatcherBase& d) + AnonymousMember (Traversal::NodeDispatcher& d) { belongs_.node_traverser (d); } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { traverse_member (a); } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { traverse_member (e); } - virtual Void + virtual void traverse_member (SemanticGraph::Member& m) { if (m.typed_p () && @@ -2230,12 +2265,12 @@ namespace XSDFrontend struct AnonymousBase: Traversal::Type { - AnonymousBase (Traversal::NodeDispatcherBase& d) + AnonymousBase (Traversal::NodeDispatcher& d) : base_ (d) { } - virtual Void + virtual void traverse (SemanticGraph::Type& t) { if (!t.named_p ()) @@ -2243,7 +2278,7 @@ namespace XSDFrontend } private: - Traversal::NodeDispatcherBase& base_; + Traversal::NodeDispatcher& base_; } anonymous_base (resolver); ns_names >> resolver; @@ -2267,7 +2302,7 @@ namespace XSDFrontend // if (valid_) { - for (DefaultValues::ConstIterator i (default_values_.begin ()), + for (DefaultValues::const_iterator i (default_values_.begin ()), e (default_values_.end ()); i != e; ++i) { SemanticGraph::Member& m (**i); @@ -2315,17 +2350,21 @@ namespace XSDFrontend return rs; } - Void Parser::Impl:: + void Parser::Impl:: schema (XML::Element const& s) { - Boolean old_qa (qualify_attribute_); - Boolean old_qe (qualify_element_); + bool old_qa (qualify_attribute_); + bool old_qe (qualify_element_); - if (String af = s["attributeFormDefault"]) + if (String af = trim (s["attributeFormDefault"])) qualify_attribute_ = af == L"qualified"; + else + qualify_attribute_ = false; - if (String ef = s["elementFormDefault"]) + if (String ef = trim (s["elementFormDefault"])) qualify_element_ = ef == L"qualified"; + else + qualify_element_ = false; push (s); @@ -2367,52 +2406,43 @@ namespace XSDFrontend qualify_element_ = old_qe; } - Void Parser::Impl:: + void Parser::Impl:: import (XML::Element const& i) { NarrowString loc ( - XML::transcode_to_narrow ( - i.dom_element ()->getAttribute ( - XML::XMLChString ("schemaLocation").c_str ()))); + trim ( + XML::transcode_to_narrow ( + i.dom_element ()->getAttribute ( + XML::XMLChString ("schemaLocation").c_str ())))); if (loc_translator_) loc = loc_translator_->translate (loc); + String ins (trim (i["namespace"])); + // Ignore empty . // - if (!loc && !i["namespace"]) + if (!loc && !ins) return; Path path, rel_path, abs_path; try { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - try - { - path = Path (loc); - } - catch (InvalidPath const&) - { - // Retry as a native path. - // - path = Path (loc, boost::filesystem::native); - } -#else - // The new ABI does not have a fallback native representation - path = Path (loc.c_str()); -#endif + path = Path (loc); - if (path.is_complete ()) + if (path.absolute ()) { abs_path = rel_path = path; + abs_path.normalize (); } else { - rel_path = file ().branch_path () / path; - abs_path = system_complete (rel_path); + // Do normalize() before complete() to avoid hitting system path + // limits with '..' directories. + // + abs_path = rel_path = file ().directory () / path; + abs_path.normalize ().complete (); } - - abs_path.normalize (); } catch (InvalidPath const&) { @@ -2424,7 +2454,7 @@ namespace XSDFrontend return; } - SchemaId schema_id (abs_path, i["namespace"]); + SchemaId schema_id (abs_path, ins); if (schema_map_.find (schema_id) != schema_map_.end ()) { @@ -2438,7 +2468,7 @@ namespace XSDFrontend if (XML::AutoPtr d = dom (abs_path, false)) { XML::Element r (d->getDocumentElement ()); - String ns (r["targetNamespace"]); + String ns (trim (r["targetNamespace"])); if (trace_) wcout << "target namespace: " << ns << endl; @@ -2451,12 +2481,12 @@ namespace XSDFrontend s.context ().set ("absolute-path", abs_path); Schema* old_cur (cur_); - Boolean old_cur_chameleon (cur_chameleon_); + bool old_cur_chameleon (cur_chameleon_); cur_ = &s; cur_chameleon_ = false; { - file_stack_.push (rel_path); + file_stack_.push (PathPair (rel_path, abs_path)); { push_scope ( @@ -2480,13 +2510,14 @@ namespace XSDFrontend } } - Void Parser::Impl:: + void Parser::Impl:: include (XML::Element const& i) { NarrowString loc ( - XML::transcode_to_narrow ( - i.dom_element ()->getAttribute ( - XML::XMLChString ("schemaLocation").c_str ()))); + trim ( + XML::transcode_to_narrow ( + i.dom_element ()->getAttribute ( + XML::XMLChString ("schemaLocation").c_str ())))); if (loc_translator_) loc = loc_translator_->translate (loc); @@ -2494,33 +2525,21 @@ namespace XSDFrontend Path path, rel_path, abs_path; try { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - try - { - path = Path (loc); - } - catch (InvalidPath const&) - { - // Retry as a native path. - // - path = Path (loc, boost::filesystem::native); - } -#else - // The new API does not have a fallback native representation. - path = Path (loc.c_str()); -#endif + path = Path (loc); - if (path.is_complete ()) + if (path.absolute ()) { abs_path = rel_path = path; + abs_path.normalize (); } else { - rel_path = file ().branch_path () / path; - abs_path = system_complete (rel_path); + // Do normalize() before complete() to avoid hitting system path + // limits with '..' directories. + // + abs_path = rel_path = file ().directory () / path; + abs_path.normalize ().complete (); } - - abs_path.normalize (); } catch (InvalidPath const&) { @@ -2559,7 +2578,7 @@ namespace XSDFrontend if (XML::AutoPtr d = dom (abs_path, false)) { XML::Element r (d->getDocumentElement ()); - String ns (r["targetNamespace"]), cur_ns; + String ns (trim (r["targetNamespace"])), cur_ns; Schema& s (s_->new_node (rel_path, r.line (), r.column ())); s_->new_edge (s, *xml_schema_, xml_schema_path_); @@ -2567,7 +2586,7 @@ namespace XSDFrontend schema_map_[schema_id] = &s; s.context ().set ("absolute-path", abs_path); - Boolean chameleon (false); + bool chameleon (false); if (ns.empty () && !(cur_ns = (cur_->names_begin ())->name ()).empty ()) { @@ -2587,12 +2606,12 @@ namespace XSDFrontend wcout << "target namespace: " << ns << endl; Schema* old_cur (cur_); - Boolean old_cur_chameleon (cur_chameleon_); + bool old_cur_chameleon (cur_chameleon_); cur_ = &s; cur_chameleon_ = chameleon; { - file_stack_.push (rel_path); + file_stack_.push (PathPair (rel_path, abs_path)); { push_scope ( @@ -2616,10 +2635,10 @@ namespace XSDFrontend } } - Void Parser::Impl:: - element_group (XML::Element const& g, Boolean in_compositor) + void Parser::Impl:: + element_group (XML::Element const& g, bool in_compositor) { - if (String name = g["name"]) + if (String name = trim (g["name"])) { ElementGroup& group ( s_->new_node (file (), g.line (), g.column ())); @@ -2659,7 +2678,7 @@ namespace XSDFrontend pop (); pop_scope (); } - else if (String ref = g["ref"]) + else if (String ref = trim (g["ref"])) { if (trace_) wcout << "element-group-ref " << ref << endl; @@ -2681,10 +2700,15 @@ namespace XSDFrontend { Compositor& c (compositor ()); + unsigned long min (parse_min (trim (g["minOccurs"]))); + unsigned long max (parse_max (trim (g["maxOccurs"]))); + ElementGroupRef ref ( uq_name, ns_name, - parse_min (g["minOccurs"]), parse_max (g["maxOccurs"]), - c, scope ()); + min, + max == unbounded ? 0 : max, + c, + scope ()); if (!c.context ().count ("element-group-refs")) c.context ().set ("element-group-refs", ElementGroupRefs ()); @@ -2699,10 +2723,11 @@ namespace XSDFrontend Scope& s (scope ()); + unsigned long min (parse_min (trim (g["minOccurs"]))); + unsigned long max (parse_max (trim (g["maxOccurs"]))); + ElementGroupRef ref ( - uq_name, ns_name, - parse_min (g["minOccurs"]), parse_max (g["maxOccurs"]), - s); + uq_name, ns_name, min, max == unbounded ? 0 : max, s); s.context ().set ("element-group-ref", ref); } @@ -2782,7 +2807,7 @@ namespace XSDFrontend List& node (s_->new_node (file (), t.line (), t.column ())); - if (String item_type = l["itemType"]) + if (String item_type = trim (l["itemType"])) { if (trace_) wcout << "item type: " << fq_name (l, item_type) << endl; @@ -2832,7 +2857,7 @@ namespace XSDFrontend pop (); } - if (String name = t["name"]) + if (String name = trim (t["name"])) s_->new_edge (scope (), node, name); return &node; @@ -2846,8 +2871,8 @@ namespace XSDFrontend // Find first non-space character. // - Size - find_ns (const WideChar* s, Size size, Size pos) + size_t + find_ns (const wchar_t* s, size_t size, size_t pos) { while (pos < size && (s[pos] == 0x20 || // space @@ -2861,8 +2886,8 @@ namespace XSDFrontend // Find first space character. // - Size - find_s (const WideChar* s, Size size, Size pos) + size_t + find_s (const wchar_t* s, size_t size, size_t pos) { while (pos < size && s[pos] != 0x20 && // space @@ -2883,26 +2908,26 @@ namespace XSDFrontend Union& node (s_->new_node (file (), t.line (), t.column ())); - Boolean has_members (false); + bool has_members (false); - if (String members = u["memberTypes"]) + if (String members = trim (u["memberTypes"])) { // Don't bother trying to resolve member types at this point // since the order is important so we would have to insert // the late resolutions into specific places. It is simpler // to just do the whole resolution later. // - const WideChar* data (members.c_str ()); - Size size (members.size ()); + const wchar_t* data (members.c_str ()); + size_t size (members.size ()); UnionMemberTypes* m (0); // Traverse the type list while logically collapsing spaces. // - for (Size i (find_ns (data, size, 0)); i != String::npos;) + for (size_t i (find_ns (data, size, 0)); i != String::npos;) { String s; - Size j (find_s (data, size, i)); + size_t j (find_s (data, size, i)); if (j != String::npos) { @@ -2985,7 +3010,7 @@ namespace XSDFrontend valid_ = false; } - if (String name = t["name"]) + if (String name = trim (t["name"])) s_->new_edge (scope (), node, name); return &node; @@ -2994,7 +3019,7 @@ namespace XSDFrontend Type* Parser::Impl:: restriction (XML::Element const& r, XML::Element const& t) { - String base (r["base"]); + String base (trim (r["base"])); Type* base_type (0); if (base) @@ -3009,7 +3034,7 @@ namespace XSDFrontend annotation (false); - Boolean enum_ (false); + bool enum_ (false); if (!base) { @@ -3051,6 +3076,7 @@ namespace XSDFrontend Facets facets; Restricts* restricts (0); + String pattern; while (more ()) { @@ -3077,7 +3103,7 @@ namespace XSDFrontend else restricts = set_type (base, r, node); - if (String name = t["name"]) + if (String name = trim (t["name"])) s_->new_edge (scope (), static_cast (node), name); rv = &node; @@ -3094,10 +3120,16 @@ namespace XSDFrontend name == L"length" || name == L"minLength" || name == L"maxLength" || - name == L"whiteSpace" || - name == L"pattern") + name == L"whiteSpace") + { + facets[name] = trim (e["value"]); + } + else if (name == L"pattern") { - facets[name] = e["value"]; + if (pattern) + pattern += L'|'; + + pattern += e["value"]; } else { @@ -3109,6 +3141,9 @@ namespace XSDFrontend } } + if (pattern) + facets[L"pattern"] = pattern; + if (enum_) pop_scope (); else @@ -3120,7 +3155,7 @@ namespace XSDFrontend else restricts = set_type (base, r, node); - if (String name = t["name"]) + if (String name = trim (t["name"])) s_->new_edge (scope (), node, name); rv = &node; @@ -3139,7 +3174,7 @@ namespace XSDFrontend return rv; } - Void Parser::Impl:: + void Parser::Impl:: enumeration (XML::Element const& e) { String value (e["value"]); @@ -3169,9 +3204,10 @@ namespace XSDFrontend Complex& node (s_->new_node (file (), t.line (), t.column ())); - node.mixed_p (t["mixed"] == L"true" || t["mixed"] == L"1"); + if (String m = trim (t["mixed"])) + node.mixed_p (m == L"true" || m == L"1"); - if (String name = t["name"]) + if (String name = trim (t["name"])) s_->new_edge (scope (), node, name); r = &node; @@ -3211,8 +3247,14 @@ namespace XSDFrontend } if (c) - s_->new_edge ( - node, *c, parse_min (e["minOccurs"]), parse_max (e["maxOccurs"])); + { + unsigned long min (parse_min (trim (e["minOccurs"]))); + unsigned long max (parse_max (trim (e["maxOccurs"]))); + + if (!(min == 0 && max == 0)) + s_->new_edge ( + node, *c, min, max == unbounded ? 0 : max); + } while (more ()) { @@ -3277,15 +3319,18 @@ namespace XSDFrontend } Choice* Parser::Impl:: - choice (XML::Element const& c, Boolean in_compositor) + choice (XML::Element const& c, bool in_compositor) { Choice& node (s_->new_node (file (), c.line (), c.column ())); if (in_compositor) { - s_->new_edge ( - compositor (), node, - parse_min (c["minOccurs"]), parse_max (c["maxOccurs"])); + unsigned long min (parse_min (trim (c["minOccurs"]))); + unsigned long max (parse_max (trim (c["maxOccurs"]))); + + if (!(min == 0 && max == 0)) + s_->new_edge ( + compositor (), node, min, max == unbounded ? 0 : max); } push_compositor (node); @@ -3321,15 +3366,18 @@ namespace XSDFrontend } Sequence* Parser::Impl:: - sequence (XML::Element const& s, Boolean in_compositor) + sequence (XML::Element const& s, bool in_compositor) { Sequence& node (s_->new_node (file (), s.line (), s.column ())); if (in_compositor) { - s_->new_edge ( - compositor (), node, - parse_min (s["minOccurs"]), parse_max (s["maxOccurs"])); + unsigned long min (parse_min (trim (s["minOccurs"]))); + unsigned long max (parse_max (trim (s["maxOccurs"]))); + + if (!(min == 0 && max == 0)) + s_->new_edge ( + compositor (), node, min, max == unbounded ? 0 : max); } push_compositor (node); @@ -3364,7 +3412,7 @@ namespace XSDFrontend return &node; } - Void Parser::Impl:: + void Parser::Impl:: simple_content (XML::Element const& c) { push (c); @@ -3387,13 +3435,11 @@ namespace XSDFrontend pop (); } - Void Parser::Impl:: + void Parser::Impl:: complex_content (XML::Element const& c, Complex& type) { - if (c.attribute_p ("mixed")) - { - type.mixed_p (c["mixed"] == L"true" || c["mixed"] == L"1"); - } + if (String m = trim (c["mixed"])) + type.mixed_p (m == L"true" || m == L"1"); push (c); @@ -3415,13 +3461,13 @@ namespace XSDFrontend pop (); } - Void Parser::Impl:: + void Parser::Impl:: simple_content_extension (XML::Element const& e) { if (trace_) wcout << "extension base: " << fq_name (e, e["base"]) << endl; - set_type (e["base"], e, dynamic_cast (scope ())); + set_type (trim (e["base"]), e, dynamic_cast (scope ())); push (e); @@ -3447,11 +3493,10 @@ namespace XSDFrontend pop (); } - Void Parser::Impl:: + void Parser::Impl:: simple_content_restriction (XML::Element const& r) { - String base (r["base"]); - Type* base_type (0); + String base (trim (r["base"])); if (trace_ && base) wcout << "restriction base: " << fq_name (r, base) << endl; @@ -3471,7 +3516,7 @@ namespace XSDFrontend if (trace_) wcout << name << endl; - if (name == L"simpleType") base_type = simple_type (e); else + if (name == L"simpleType") simple_type (e); else { wcerr << file () << ":" << e.line () << ":" << e.column () << ": " << "error: expected 'simpleType' instead of " @@ -3497,6 +3542,7 @@ namespace XSDFrontend } Facets facets; + String pattern; while (more ()) { @@ -3532,10 +3578,16 @@ namespace XSDFrontend name == L"length" || name == L"minLength" || name == L"maxLength" || - name == L"whiteSpace" || - name == L"pattern") + name == L"whiteSpace") + { + facets[name] = trim (e["value"]); + } + else if (name == L"pattern") { - facets[name] = e["value"]; + if (pattern) + pattern += L'|'; + + pattern += e["value"]; } else if (name == L"attribute") { @@ -3562,6 +3614,9 @@ namespace XSDFrontend } } + if (pattern) + facets[L"pattern"] = pattern; + Complex& type (dynamic_cast (scope ())); Restricts* restricts = set_type (base, r, type); @@ -3576,13 +3631,13 @@ namespace XSDFrontend pop (); } - Void Parser::Impl:: + void Parser::Impl:: complex_content_extension (XML::Element const& e, Complex& type) { if (trace_) wcout << "extension base: " << fq_name (e, e["base"]) << endl; - set_type (e["base"], e, dynamic_cast (scope ())); + set_type (trim (e["base"]), e, dynamic_cast (scope ())); push (e); @@ -3609,8 +3664,14 @@ namespace XSDFrontend } if (c) - s_->new_edge ( - type, *c, parse_min (e["minOccurs"]), parse_max (e["maxOccurs"])); + { + unsigned long min (parse_min (trim (e["minOccurs"]))); + unsigned long max (parse_max (trim (e["maxOccurs"]))); + + if (!(min == 0 && max == 0)) + s_->new_edge ( + type, *c, min, max == unbounded ? 0 : max); + } while (more ()) { @@ -3633,13 +3694,16 @@ namespace XSDFrontend pop (); } - Void Parser::Impl:: + void Parser::Impl:: complex_content_restriction (XML::Element const& e, Complex& type) { if (trace_) wcout << "restriction base: " << fq_name (e, e["base"]) << endl; - set_type (e["base"], e, dynamic_cast (scope ())); + set_type ( + trim (e["base"]), + e, + dynamic_cast (scope ())); // @@ // For now we simply skip the contents unless the base is anyType @@ -3650,7 +3714,7 @@ namespace XSDFrontend // if (!proper_restriction_) { - String base (e["base"]); + String base (trim (e["base"])); String uq_name (unqualified_name (base)); String ns_name (namespace_name (e, base)); @@ -3683,8 +3747,14 @@ namespace XSDFrontend } if (c) - s_->new_edge ( - type, *c, parse_min (e["minOccurs"]), parse_max (e["maxOccurs"])); + { + unsigned long min (parse_min (trim (e["minOccurs"]))); + unsigned long max (parse_max (trim (e["maxOccurs"]))); + + if (!(min == 0 && max == 0)) + s_->new_edge ( + type, *c, min, max == unbounded ? 0 : max); + } while (more ()) { @@ -3707,18 +3777,18 @@ namespace XSDFrontend pop (); } - Void Parser::Impl:: - element (XML::Element const& e, Boolean global) + void Parser::Impl:: + element (XML::Element const& e, bool global) { - Boolean qualified (global ? true : qualify_element_); + bool qualified (global ? true : qualify_element_); - if (String form = e["form"]) + if (String form = trim (e["form"])) qualified = form == L"qualified"; if (trace_) wcout << "element qualified: " << qualified << endl; - if (String name = e["name"]) + if (String name = trim (e["name"])) { if (trace_) wcout << "element name '" << name << "'" << endl; @@ -3727,17 +3797,24 @@ namespace XSDFrontend s_->new_node ( file (), e.line (), e.column (), global, qualified)); - s_->new_edge (scope (), node, name); - - if (qualified) - s_->new_edge (node, cur_ns ()); - if (!global) { - s_->new_edge ( - compositor (), node, - parse_min (e["minOccurs"]), parse_max (e["maxOccurs"])); + unsigned long min (parse_min (trim (e["minOccurs"]))); + unsigned long max (parse_max (trim (e["maxOccurs"]))); + + if (!(min == 0 && max == 0)) + { + s_->new_edge (scope (), node, name); + + s_->new_edge ( + compositor (), node, min, max == unbounded ? 0 : max); + } } + else + s_->new_edge (scope (), node, name); + + if (qualified) + s_->new_edge (node, cur_ns ()); // Default and fixed values are mutually exclusive. // @@ -3752,13 +3829,16 @@ namespace XSDFrontend default_values_.push_back (&node); } + bool subst (false); if (global) { - if (String sg = e["substitutionGroup"]) + if (String sg = trim (e["substitutionGroup"])) { if (trace_) wcout << "substitutes " << sg << endl; + subst = true; + try { String uq_name (unqualified_name (sg)); @@ -3778,7 +3858,7 @@ namespace XSDFrontend } } - if (String type = e["type"]) + if (String type = trim (e["type"])) { if (trace_) wcout << "element type " << fq_name (e, type) << endl; @@ -3827,10 +3907,12 @@ namespace XSDFrontend if (t) s_->new_edge (node, *t); } - else + // By default the type is anyType unless this element is a + // member of a substitution group, in which case it has the + // same type as the element it substiutes. + // + else if (!subst) { - // anyType - // if (!is_disabled ("F001")) { wcerr << file () << ":" << e.line () << ":" << e.column () << ": " @@ -3851,18 +3933,14 @@ namespace XSDFrontend pop (); } } - else if (String ref = e["ref"]) + else if (String ref = trim (e["ref"])) { Element& node ( s_->new_node ( file (), e.line (), e.column (), true, true)); - // Ref can only be in compositor. - // - s_->new_edge ( - compositor (), node, - parse_min (e["minOccurs"]), parse_max (e["maxOccurs"])); - + unsigned long min (parse_min (trim (e["minOccurs"]))); + unsigned long max (parse_max (trim (e["maxOccurs"]))); // Default and fixed values are mutually exclusive. // @@ -3886,119 +3964,127 @@ namespace XSDFrontend pop (); - // Try to resolve the prototype. - // - try + if (!(min == 0 && max == 0)) { - String uq_name (unqualified_name (ref)); - String ns_name (namespace_name (e, ref)); - - s_->new_edge (scope (), node, uq_name); - - Element& prot (resolve (ns_name, uq_name, *s_, *cache_)); - s_->new_edge (node, prot.namespace_ ()); + // Ref can only be in compositor. + // + s_->new_edge ( + compositor (), node, min, max == unbounded ? 0 : max); - // Copy substitution group information if any. + // Try to resolve the prototype. // - if (prot.context ().count ("substitution-ns-name")) + try { - node.context ().set ( - "substitution-ns-name", - prot.context ().get ("substitution-ns-name")); + String uq_name (unqualified_name (ref)); + String ns_name (namespace_name (e, ref)); - node.context ().set ( - "substitution-uq-name", - prot.context ().get ("substitution-uq-name")); - } + s_->new_edge (scope (), node, uq_name); - // Transfer default and fixed values if the ref declaration hasn't - // defined its own. - // - if (!node.default_p ()) - { - if (prot.fixed_p ()) - node.fixed (prot.value ()); - else if (prot.default_p ()) - node.default_ (prot.value ()); + Element& prot (resolve (ns_name, uq_name, *s_, *cache_)); + s_->new_edge (node, prot.namespace_ ()); - if (node.default_p ()) + // Copy substitution group information if any. + // + if (prot.context ().count ("substitution-ns-name")) { node.context ().set ( - "dom-node", - prot.context ().get ("dom-node")); - default_values_.push_back (&node); + "substitution-ns-name", + prot.context ().get ("substitution-ns-name")); + + node.context ().set ( + "substitution-uq-name", + prot.context ().get ("substitution-uq-name")); } - } - // Transfer annotation if the ref declaration hasn't defined its own. - // - if (!node.annotated_p () && prot.annotated_p ()) - s_->new_edge (prot.annotation (), node); + // Transfer default and fixed values if the ref declaration hasn't + // defined its own. + // + if (!node.default_p ()) + { + if (prot.fixed_p ()) + node.fixed (prot.value ()); + else if (prot.default_p ()) + node.default_ (prot.value ()); - // Set type information. - // - if (prot.typed_p ()) - { - s_->new_edge (node, prot.type ()); + if (node.default_p ()) + { + node.context ().set ( + "dom-node", + prot.context ().get ("dom-node")); + default_values_.push_back (&node); + } + } + + // Transfer annotation if the ref declaration hasn't defined its own. + // + if (!node.annotated_p () && prot.annotated_p ()) + s_->new_edge (prot.annotation (), node); + + // Set type information. + // + if (prot.typed_p ()) + { + s_->new_edge (node, prot.type ()); + } + else if (prot.context ().count ("type-ns-name")) + { + String ns_name (prot.context ().get ("type-ns-name")); + String uq_name (prot.context ().get ("type-uq-name")); + + node.context ().set ("type-ns-name", ns_name); + node.context ().set ("type-uq-name", uq_name); + node.context ().set ("edge-type-id", type_id (typeid (Belongs))); + + if (trace_) + wcout << "element '" << ref << "' is not typed" << endl + << "deferring resolution until later" << endl; + } + else + { + // This could be a recursive reference to an element who's + // (anonymous) type is being defined. We are going to let + // resolver sort out this case. + // + node.context ().set ("instance-ns-name", ns_name); + node.context ().set ("instance-uq-name", uq_name); + + if (trace_) + wcout << "looks like a recursive reference to an element '" + << ns_name << "#" << uq_name << "' which is being " + << "defined" << endl + << "deferring resolution until later" << endl; + } } - else if (prot.context ().count ("type-ns-name")) + catch (NotNamespace const& ex) { - String ns_name (prot.context ().get ("type-ns-name")); - String uq_name (prot.context ().get ("type-uq-name")); - - node.context ().set ("type-ns-name", ns_name); - node.context ().set ("type-uq-name", uq_name); - node.context ().set ("edge-type-id", TypeId (typeid (Belongs))); + if (valid_) + { + wcerr << file () << ":" << e.line () << ":" << e.column () << ": " + << "ice: unable to resolve namespace '" << ex.ns () << "'" + << endl; - if (trace_) - wcout << "element '" << ref << "' is not typed" << endl - << "deferring resolution until later" << endl; + abort (); + } } - else + catch (NotName const& ex) { - // This could be a recursive reference to an element who's - // (anonymous) type is being defined. We are going to let - // resolver sort out this case. - // - node.context ().set ("instance-ns-name", ns_name); - node.context ().set ("instance-uq-name", uq_name); + node.context ().set ("instance-ns-name", ex.ns ()); + node.context ().set ("instance-uq-name", ex.name ()); if (trace_) - wcout << "looks like a recursive reference to an element '" - << ns_name << "#" << uq_name << "' which is being " - << "defined" << endl + wcout << "unable to resolve name '" << ex.name () + << "' inside namespace '" << ex.ns () << "'" << endl << "deferring resolution until later" << endl; } - } - catch (NotNamespace const& ex) - { - if (valid_) + catch (XML::NoMapping const& ex) { wcerr << file () << ":" << e.line () << ":" << e.column () << ": " - << "ice: unable to resolve namespace '" << ex.ns () << "'" - << endl; + << "error: unable to resolve namespace prefix '" + << ex.prefix () << "' in '" << ref << "'" << endl; - abort (); + valid_ = false; } } - catch (NotName const& ex) - { - node.context ().set ("instance-ns-name", ex.ns ()); - node.context ().set ("instance-uq-name", ex.name ()); - - if (trace_) - wcout << "unable to resolve name '" << ex.name () - << "' inside namespace '" << ex.ns () << "'" << endl - << "deferring resolution until later" << endl; - } - catch (XML::NoMapping const& ex) - { - wcerr << file () << ":" << e.line () << ":" << e.column () << ": " - << "error: unable to resolve namespace prefix '" - << ex.prefix () << "' in '" << ref << "'" << endl; - - valid_ = false; - } } else { @@ -4012,7 +4098,7 @@ namespace XSDFrontend } SemanticGraph::Annotation* Parser::Impl:: - annotation (Boolean process) + annotation (bool process) { Annotation* r (0); @@ -4039,7 +4125,7 @@ namespace XSDFrontend // Use first non-structured (text only) documentation element. // String text; - Boolean struc (false); + bool struc (false); DOMElement* de (doc.dom_element()); for (DOMNode* n (de->getFirstChild ()); @@ -4085,24 +4171,24 @@ namespace XSDFrontend } - Void Parser::Impl:: - attribute (XML::Element const& a, Boolean global) + void Parser::Impl:: + attribute (XML::Element const& a, bool global) { - Boolean optional (true); + bool optional (true); - String use (a["use"]); + String use (trim (a["use"])); if (use == L"prohibited") return; else if (use == L"required") optional = false; - Boolean qualified (global ? true : qualify_attribute_); + bool qualified (global ? true : qualify_attribute_); - if (String form = a["form"]) + if (String form = trim (a["form"])) qualified = form == L"qualified"; - if (String name = a["name"]) + if (String name = trim (a["name"])) { if (trace_) wcout << "attribute '" << name << "'" << endl; @@ -4130,7 +4216,7 @@ namespace XSDFrontend default_values_.push_back (&node); } - if (String type = a["type"]) + if (String type = trim (a["type"])) { if (trace_) wcout << "attribute type: '" << fq_name (a, type) << "'" << endl; @@ -4202,7 +4288,7 @@ namespace XSDFrontend pop (); } } - else if (String ref = a["ref"]) + else if (String ref = trim (a["ref"])) { Attribute& node ( s_->new_node ( @@ -4280,7 +4366,7 @@ namespace XSDFrontend node.context ().set ("type-ns-name", ns_name); node.context ().set ("type-uq-name", uq_name); - node.context ().set ("edge-type-id", TypeId (typeid (Belongs))); + node.context ().set ("edge-type-id", type_id (typeid (Belongs))); if (trace_) wcout << "attribute '" << ref << "' is not typed" << endl @@ -4342,10 +4428,10 @@ namespace XSDFrontend } } - Void Parser::Impl:: + void Parser::Impl:: attribute_group (XML::Element const& g) { - if (String name = g["name"]) + if (String name = trim (g["name"])) { // Global definition. // @@ -4384,7 +4470,7 @@ namespace XSDFrontend pop (); pop_scope (); } - else if (String ref = g["ref"]) + else if (String ref = trim (g["ref"])) { if (trace_) wcout << "attribute-group-ref " << ref << endl; @@ -4441,20 +4527,22 @@ namespace XSDFrontend } } - Void Parser::Impl:: + void Parser::Impl:: any (XML::Element const& a) { if (trace_) wcout << "any" << endl; - String namespaces (a["namespace"] ? a["namespace"] : L"##any"); + String namespaces (trim (a["namespace"])); + + if (!namespaces) + namespaces = L"##any"; Any& any ( s_->new_node (file (), a.line (), a.column (), namespaces)); - s_->new_edge ( - compositor (), any, - parse_min (a["minOccurs"]), parse_max (a["maxOccurs"])); + unsigned long min (parse_min (trim (a["minOccurs"]))); + unsigned long max (parse_max (trim (a["maxOccurs"]))); // Parse annotation. // @@ -4465,33 +4553,42 @@ namespace XSDFrontend pop (); - // Any has no name so we have to come up with a fake one in order to - // put it into the scope. - // - UnsignedLong count; - FrontendElements::Context& ctx (scope ().context ()); - - if (!ctx.count ("any-name-count")) + if (!(min == 0 && max == 0)) { - count = 0; - ctx.set ("any-name-count", count); - } - else - count = ++(ctx.get ("any-name-count")); + s_->new_edge ( + compositor (), any, min, max == unbounded ? 0 : max); - std::basic_ostringstream os; - os << "any #" << count; + // Any has no name so we have to come up with a fake one in order to + // put it into the scope. + // + unsigned long count; + SemanticGraph::Context& ctx (scope ().context ()); - s_->new_edge (scope (), any, os.str ()); + if (!ctx.count ("any-name-count")) + { + count = 0; + ctx.set ("any-name-count", count); + } + else + count = ++(ctx.get ("any-name-count")); + + std::basic_ostringstream os; + os << "any #" << count; + + s_->new_edge (scope (), any, os.str ()); + } } - Void Parser::Impl:: + void Parser::Impl:: any_attribute (XML::Element const& a) { if (trace_) wcout << "anyAttribute" << endl; - String namespaces (a["namespace"] ? a["namespace"] : L"##any"); + String namespaces (trim (a["namespace"])); + + if (!namespaces) + namespaces = L"##any"; AnyAttribute& any ( s_->new_node ( @@ -4510,8 +4607,8 @@ namespace XSDFrontend // in order to put it into the scope. // - UnsignedLong count; - FrontendElements::Context& ctx (scope ().context ()); + unsigned long count; + SemanticGraph::Context& ctx (scope ().context ()); if (!ctx.count ("any-attribute-name-count")) { @@ -4519,9 +4616,9 @@ namespace XSDFrontend ctx.set ("any-attribute-name-count", count); } else - count = ++(ctx.get ("any-attribute-name-count")); + count = ++(ctx.get ("any-attribute-name-count")); - std::basic_ostringstream os; + std::basic_ostringstream os; os << "any-attribute #" << count; s_->new_edge (scope (), any, os.str ()); @@ -4573,7 +4670,7 @@ namespace XSDFrontend { // See if we've got 'xse:refType' attribute. // - if (String ref_type = e.attribute (xse, "refType")) + if (String ref_type = trim (e.attribute (xse, "refType"))) { if (trace_) wcout << "found refType attribute '" << ref_type << "'" << endl; @@ -4618,7 +4715,7 @@ namespace XSDFrontend { node.context ().set ("type-ns-name", ex.ns ()); node.context ().set ("type-uq-name", ex.name ()); - node.context ().set ("edge-type-id", TypeId (typeid (Edge))); + node.context ().set ("edge-type-id", type_id (typeid (Edge))); if (trace_) wcout << "unable to resolve name '" << ex.name () @@ -4641,14 +4738,16 @@ namespace XSDFrontend // that can later be used in diagnostics. Unfortunately, it doesn't // work. So we will have to keep our own track. // - struct Context: public NonCopyable + struct Context { + Context () {} + // File map for diagnostic. // Path const& file (Path const& abs) const { - FileMap::ConstIterator i (file_map_.find (abs)); + FileMap::const_iterator i (file_map_.find (abs)); if (i != file_map_.end ()) { @@ -4660,14 +4759,18 @@ namespace XSDFrontend } } - Void + void map_file (Path const& abs, Path const& rel) { file_map_[abs] = rel; } private: - typedef Cult::Containers::Map FileMap; + Context (Context const&); + Context& operator= (Context const&); + + private: + typedef std::map FileMap; FileMap file_map_; }; @@ -4676,13 +4779,13 @@ namespace XSDFrontend class ErrorHandler : public Xerces::DOMErrorHandler { public: - ErrorHandler (Boolean& valid, XSDFrontend::Context const& ctx) + ErrorHandler (bool& valid, XSDFrontend::Context const& ctx) : valid_ (valid), ctx_ (ctx) { } - virtual Boolean + virtual bool handleError (Xerces::DOMError const& e) { // Xerces likes to say "Fatal error encountered during schema scan". @@ -4694,14 +4797,8 @@ namespace XSDFrontend return true; -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - XSDFrontend::SemanticGraph::Path abs_path ( - XML::transcode_to_narrow (e.getLocation ()->getURI ()), - boost::filesystem::native); -#else XSDFrontend::SemanticGraph::Path abs_path ( - XML::transcode_to_narrow (e.getLocation ()->getURI ()).c_str()); -#endif + XML::transcode_to_narrow (e.getLocation ()->getURI ())); XSDFrontend::SemanticGraph::Path rel_path (ctx_.file (abs_path)); @@ -4730,7 +4827,7 @@ namespace XSDFrontend } private: - Boolean& valid_; + bool& valid_; XSDFrontend::Context const& ctx_; }; @@ -4754,12 +4851,7 @@ namespace XSDFrontend base_ (base), ctx_ (ctx) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - setSystemId (XML::XMLChString ( - String (abs_.native_file_string ())).c_str ()); -#else setSystemId (XML::XMLChString (String (abs_.string ())).c_str ()); -#endif } virtual Xerces::BinInputStream* @@ -4794,11 +4886,7 @@ namespace XSDFrontend class EntityResolver: public Xerces::XMemory, -#if _XERCES_VERSION >= 30000 public Xerces::DOMLSResourceResolver -#else - public Xerces::DOMEntityResolver -#endif { public: EntityResolver (XSDFrontend::Context& ctx, LocationTranslator* t) @@ -4806,19 +4894,12 @@ namespace XSDFrontend { } -#if _XERCES_VERSION >= 30000 virtual Xerces::DOMLSInput* resolveResource(XMLCh const* const, XMLCh const* const, XMLCh const* const /*pub_id*/, XMLCh const* const prv_id, XMLCh const* const base_uri) -#else - virtual Xerces::DOMInputSource* - resolveEntity (XMLCh const* const /*pub_id*/, - XMLCh const* const prv_id, - XMLCh const* const base_uri) -#endif { /* XMLCh empty[1]; @@ -4832,12 +4913,7 @@ namespace XSDFrontend // base_uri should be a valid path by now. // -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - Path base (XML::transcode_to_narrow (base_uri), - boost::filesystem::native); -#else - Path base (XML::transcode_to_narrow (base_uri).c_str()); -#endif + Path base (XML::transcode_to_narrow (base_uri)); if (prv_id == 0) { @@ -4861,36 +4937,19 @@ namespace XSDFrontend try { - Path path; - -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - try - { - path = Path (path_str); - } - catch (InvalidPath const&) - { - // Retry as a native path. - // - path = Path (path_str, boost::filesystem::native); - } -#else - // The new ABI does not have a fallback native representation - path = Path (path_str.c_str()); -#endif - - Path base_dir (base.branch_path ()); + Path path (path_str); + Path base_dir (base.directory ()); Path abs_path, rel_path; - if (path.is_complete ()) + if (path.absolute ()) { abs_path = rel_path = path; } else { abs_path = base_dir / path; - rel_path = ctx_.file (base).branch_path () / path; + rel_path = ctx_.file (base).directory () / path; } abs_path.normalize (); @@ -4928,7 +4987,7 @@ namespace XSDFrontend XML::AutoPtr Parser::Impl:: - dom (Path const& tu, Boolean validate) + dom (Path const& tu, bool validate) { using namespace Xerces; @@ -4936,8 +4995,11 @@ namespace XSDFrontend { XSDFrontend::Context ctx; - Path abs_path (system_complete (tu)); - abs_path.normalize (); + // Do normalize() before complete() to avoid hitting system path + // limits with '..' directories. + // + Path abs_path (tu); + abs_path.normalize ().complete (); ctx.map_file (abs_path, tu); InputSource input_source (abs_path, tu, abs_path, ctx); @@ -4958,7 +5020,6 @@ namespace XSDFrontend // Create a DOMBuilder. // -#if _XERCES_VERSION >= 30000 XML::AutoPtr parser ( impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); @@ -4990,29 +5051,6 @@ namespace XSDFrontend Wrapper4InputSource wrap (&input_source, false); parser->loadGrammar (&wrap, Grammar::SchemaGrammarType); -#else - XML::AutoPtr parser ( - impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); - - parser->setFeature (XMLUni::fgDOMComments, false); - parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); - parser->setFeature (XMLUni::fgDOMEntities, false); - parser->setFeature (XMLUni::fgDOMNamespaces, true); - parser->setFeature (XMLUni::fgDOMValidation, true); - parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); - parser->setFeature (XMLUni::fgXercesSchema, true); - parser->setFeature (XMLUni::fgXercesSchemaFullChecking, full_schema_check_); - parser->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true); - - ErrorHandler eh (valid_, ctx); - parser->setErrorHandler (&eh); - - EntityResolver er (ctx, loc_translator_); - parser->setEntityResolver (&er); - - Wrapper4InputSource wrap (&input_source, false); - parser->loadGrammar (wrap, Grammar::SchemaGrammarType); -#endif } if (!valid_) @@ -5038,7 +5076,7 @@ namespace XSDFrontend } catch (Xerces::DOMException const& e) { - Size const size = 2047; + size_t const size = 2047; XMLCh text[size + 1]; wcerr << tu << ": ice: Xerces::DOMException: "; @@ -5081,9 +5119,9 @@ namespace XSDFrontend } Parser:: - Parser (Boolean proper_restriction, - Boolean multiple_imports, - Boolean full_schema_check) + Parser (bool proper_restriction, + bool multiple_imports, + bool full_schema_check) : impl_ (new Impl (proper_restriction, multiple_imports, full_schema_check, @@ -5093,9 +5131,9 @@ namespace XSDFrontend } Parser:: - Parser (Boolean proper_restriction, - Boolean multiple_imports, - Boolean full_schema_check, + Parser (bool proper_restriction, + bool multiple_imports, + bool full_schema_check, LocationTranslator& t, const WarningSet& d) : impl_ (new Impl (proper_restriction, @@ -5106,19 +5144,19 @@ namespace XSDFrontend { } - Evptr Parser:: + auto_ptr Parser:: parse (SemanticGraph::Path const& path) { return impl_->parse (path); } - Evptr Parser:: + auto_ptr Parser:: parse (SemanticGraph::Paths const& paths) { return impl_->parse (paths); } - Evptr Parser:: + auto_ptr Parser:: xml_schema (SemanticGraph::Path const& path) { return impl_->xml_schema (path); diff --git a/libxsd-frontend/xsd-frontend/parser.hxx b/libxsd-frontend/xsd-frontend/parser.hxx index ac0ff4d..746aa97 100644 --- a/libxsd-frontend/xsd-frontend/parser.hxx +++ b/libxsd-frontend/xsd-frontend/parser.hxx @@ -1,20 +1,18 @@ // file : xsd-frontend/parser.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_PARSER_HXX #define XSD_FRONTEND_PARSER_HXX -#include -#include +#include +#include // std::auto_ptr +#include #include namespace XSDFrontend { - using namespace Cult::Types; - struct InvalidSchema {}; class LocationTranslator @@ -30,46 +28,50 @@ namespace XSDFrontend // Set of disabled warning IDs. Special ID "all" disables all // warnings. // - typedef Cult::Containers::Set WarningSet; + typedef std::set WarningSet; - class Parser: public NonCopyable + class Parser { public: ~Parser (); - Parser (Boolean proper_restriction, - Boolean multiple_imports, - Boolean full_schema_check); + Parser (bool proper_restriction, + bool multiple_imports, + bool full_schema_check); - Parser (Boolean proper_restriction, - Boolean multiple_imports, - Boolean full_schema_check, + Parser (bool proper_restriction, + bool multiple_imports, + bool full_schema_check, LocationTranslator&, const WarningSet& disabled); + private: + Parser (Parser const&); + Parser& operator= (Parser const&); + public: // Parse a schema file. Throws InvalidSchema in case of a failure. // - Evptr + std::auto_ptr parse (SemanticGraph::Path const&); // Parse a number of schema files all into one semantic graph. // Each schema file is imported from an unnamed root translation // unit. Throws InvalidSchema in case of a failure. // - Evptr + std::auto_ptr parse (SemanticGraph::Paths const&); // Returns a schema graph that corresponds to the XML Schema // namespace with built-in type definitions. The path is fake // and is only used as a lable. // - Evptr + std::auto_ptr xml_schema (SemanticGraph::Path const&); private: class Impl; - Evptr impl_; + std::auto_ptr impl_; }; } diff --git a/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx b/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx index 452980c..73a0f83 100644 --- a/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx +++ b/libxsd-frontend/xsd-frontend/schema-dom-parser.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/schema-dom-parser.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -44,11 +43,7 @@ namespace XSDFrontend const unsigned int url_id, const XMLCh* const prefix, const RefVectorOf& attributes, -#if _XERCES_VERSION >= 30000 const XMLSize_t attr_count, -#else - const unsigned int attr_count, -#endif const bool empty, const bool root) { @@ -77,18 +72,8 @@ namespace XSDFrontend ReaderMgr::LastExtEntityInfo info; ((ReaderMgr*) fScanner->getLocator())->getLastExtEntityInfo(info); -#if _XERCES_VERSION >= 30000 unsigned long l (static_cast (info.lineNumber)); unsigned long c (static_cast (info.colNumber)); -#else - unsigned long l (info.lineNumber == -1 - ? 0UL - : static_cast (info.lineNumber)); - - unsigned long c (info.colNumber == -1 - ? 0UL - : static_cast (info.colNumber)); -#endif fCurrentNode->setUserData (line_key, reinterpret_cast (l), 0); fCurrentNode->setUserData (column_key, reinterpret_cast (c), 0); @@ -124,11 +109,7 @@ namespace XSDFrontend void SchemaDOMParser:: docCharacters (const XMLCh* const s, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata) { // Ignore chars outside of content. @@ -177,11 +158,7 @@ namespace XSDFrontend void SchemaDOMParser:: ignorableWhitespace (const XMLCh* const s, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata) { // Ignore chars before the root element. diff --git a/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx b/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx index 7571677..344065a 100644 --- a/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx +++ b/libxsd-frontend/xsd-frontend/schema-dom-parser.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/schema-dom-parser.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SCHEMA_DOM_PARSER_HXX @@ -13,6 +12,8 @@ #include #include +#include // Check Xerces-C++ version. + namespace XSDFrontend { namespace XML @@ -35,11 +36,7 @@ namespace XSDFrontend const unsigned int url_id, const XMLCh* const prefix, const Xerces::RefVectorOf& attributes, -#if _XERCES_VERSION >= 30000 const XMLSize_t attribute_count, -#else - const unsigned int attribute_count, -#endif const bool empty, const bool root); @@ -51,11 +48,7 @@ namespace XSDFrontend virtual void docCharacters (const XMLCh* const, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata); virtual void @@ -69,11 +62,7 @@ namespace XSDFrontend virtual void ignorableWhitespace (const XMLCh* const, -#if _XERCES_VERSION >= 30000 const XMLSize_t length, -#else - const unsigned int length, -#endif const bool cdata); private: SchemaDOMParser (SchemaDOMParser const&); diff --git a/libxsd-frontend/xsd-frontend/semantic-graph.hxx b/libxsd-frontend/xsd-frontend/semantic-graph.hxx index bee17fc..36d42c3 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_HXX diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx index 22793f7..17a0f03 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx @@ -1,19 +1,16 @@ // file : xsd-frontend/semantic-graph/annotation.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + using compiler::type_info; // Annotates // @@ -23,11 +20,10 @@ namespace XSDFrontend { AnnotatesInit () { - TypeInfo ti (typeid (Annotates)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Annotates)); + ti.add_base (typeid (Edge)); + insert (ti); } - } annotates_init_; } @@ -39,11 +35,10 @@ namespace XSDFrontend { AnnotationInit () { - TypeInfo ti (typeid (Annotation)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Annotation)); + ti.add_base (typeid (Node)); + insert (ti); } - } annotation_init_; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx index 661ac72..0464f4f 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/annotation.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANNOTATION_HXX @@ -25,29 +24,20 @@ namespace XSDFrontend return *annotation_; } - protected: - friend class Bits::Graph; - - Annotates () - : annotation_ (0) - { - } + public: + Annotates (): annotation_ (0) {} - Void + void set_left_node (Annotation& a) { annotation_ = &a; } - Void - set_right_node (Node&) - { - } + void + set_right_node (Node&) {} - Void - set_right_node (Edge&) - { - } + void + set_right_node (Edge&) {} private: Annotation* annotation_; @@ -58,30 +48,26 @@ namespace XSDFrontend class Annotation: public virtual Node { public: - WideString const& + String const& documentation () const { return documentation_; } - protected: - friend class Bits::Graph; - + public: Annotation (Path const& file, - UnsignedLong line, - UnsignedLong column, - WideString const& documentation) + unsigned long line, + unsigned long column, + String const& documentation) : Node (file, line, column), documentation_ (documentation) { } - Void - add_edge_left (Annotates&) - { - } + void + add_edge_left (Annotates&) {} private: - WideString documentation_; + String documentation_; }; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx index e25e742..19b9df2 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx @@ -1,8 +1,9 @@ // file : xsd-frontend/semantic-graph/any-attribute.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include @@ -10,30 +11,11 @@ namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct AnyAttributeInit - { - AnyAttributeInit () - { - TypeInfo ti (typeid (AnyAttribute)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); - } - - } any_attribute_init_; - } - AnyAttribute:: AnyAttribute (Path const& file, - UnsignedLong line, - UnsignedLong column, - WideString const& namespaces) + unsigned long line, + unsigned long column, + String const& namespaces) : Node (file, line, column), prototype_ (0) { @@ -41,11 +23,11 @@ namespace XSDFrontend // chararcter. // - for (Size i (0), j (namespaces.find (L' '));;) + for (size_t i (0), j (namespaces.find (L' '));;) { - if (j != WideString::npos) + if (j != String::npos) { - namespaces_.push_back (WideString (namespaces, i, j - i)); + namespaces_.push_back (String (namespaces, i, j - i)); i = j + 1; j = namespaces.find (L' ', i); @@ -54,7 +36,7 @@ namespace XSDFrontend { // Last element. // - namespaces_.push_back (WideString (namespaces, i)); + namespaces_.push_back (String (namespaces, i)); break; } } @@ -62,8 +44,8 @@ namespace XSDFrontend AnyAttribute:: AnyAttribute (Path const& file, - UnsignedLong line, - UnsignedLong column, + unsigned long line, + unsigned long column, NamespaceIterator begin, NamespaceIterator end) : Node (file, line, column), @@ -110,5 +92,20 @@ namespace XSDFrontend return namespace_ (scope ()); } + + namespace + { + using compiler::type_info; + + struct AnyAttributeInit + { + AnyAttributeInit () + { + type_info ti (typeid (AnyAttribute)); + ti.add_base (typeid (Nameable)); + insert (ti); + } + } any_attribute_init_; + } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx index bc8c512..bb3d761 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/semantic-graph/any-attribute.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANY_ATTRIBUTE_HXX #define XSD_FRONTEND_SEMANTIC_GRAPH_ANY_ATTRIBUTE_HXX -#include +#include #include #include @@ -17,12 +16,10 @@ namespace XSDFrontend { class AnyAttribute: public virtual Nameable { - typedef - Cult::Containers::Vector - Namespaces; + typedef std::vector Namespaces; public: - typedef Namespaces::ConstIterator NamespaceIterator; + typedef Namespaces::const_iterator NamespaceIterator; NamespaceIterator namespace_begin () const @@ -37,7 +34,7 @@ namespace XSDFrontend } public: - Boolean + bool prototype_p () { return prototype_ != 0; @@ -50,7 +47,7 @@ namespace XSDFrontend return *prototype_; } - Void + void prototype (AnyAttribute& a) { assert (prototype_ == 0); @@ -61,17 +58,15 @@ namespace XSDFrontend Namespace& definition_namespace (); - protected: - friend class Bits::Graph; - + public: AnyAttribute (Path const& file, - UnsignedLong line, - UnsignedLong column, - WideString const& namespaces); + unsigned long line, + unsigned long column, + String const& namespaces); AnyAttribute (Path const& file, - UnsignedLong line, - UnsignedLong column, + unsigned long line, + unsigned long column, NamespaceIterator begin, NamespaceIterator end); diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx index a6c9e72..c8ebc93 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx @@ -1,8 +1,9 @@ // file : xsd-frontend/semantic-graph/any.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include @@ -10,31 +11,11 @@ namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct AnyInit - { - AnyInit () - { - TypeInfo ti (typeid (Any)); - ti.add_base (Access::public_, true, typeid (Nameable)); - ti.add_base (Access::public_, true, typeid (Particle)); - RTTI::insert (ti); - } - - } any_init_; - } - Any:: Any (Path const& file, - UnsignedLong line, - UnsignedLong column, - WideString const& namespaces) + unsigned long line, + unsigned long column, + String const& namespaces) : Node (file, line, column), prototype_ (0) { @@ -42,11 +23,11 @@ namespace XSDFrontend // chararcter. // - for (Size i (0), j (namespaces.find (L' '));;) + for (size_t i (0), j (namespaces.find (L' '));;) { - if (j != WideString::npos) + if (j != String::npos) { - namespaces_.push_back (WideString (namespaces, i, j - i)); + namespaces_.push_back (String (namespaces, i, j - i)); i = j + 1; j = namespaces.find (L' ', i); @@ -55,7 +36,7 @@ namespace XSDFrontend { // Last element. // - namespaces_.push_back (WideString (namespaces, i)); + namespaces_.push_back (String (namespaces, i)); break; } } @@ -63,8 +44,8 @@ namespace XSDFrontend Any:: Any (Path const& file, - UnsignedLong line, - UnsignedLong column, + unsigned long line, + unsigned long column, NamespaceIterator begin, NamespaceIterator end) : Node (file, line, column), @@ -121,5 +102,21 @@ namespace XSDFrontend return namespace_ (scope); } + + namespace + { + using compiler::type_info; + + struct AnyInit + { + AnyInit () + { + type_info ti (typeid (Any)); + ti.add_base (typeid (Nameable)); + ti.add_base (typeid (Particle)); + insert (ti); + } + } any_init_; + } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx index ded9bd8..8e42762 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/semantic-graph/any.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANY_HXX #define XSD_FRONTEND_SEMANTIC_GRAPH_ANY_HXX -#include +#include #include #include @@ -19,12 +18,10 @@ namespace XSDFrontend class Any: public virtual Nameable, public virtual Particle { - typedef - Cult::Containers::Vector - Namespaces; + typedef std::vector Namespaces; public: - typedef Namespaces::ConstIterator NamespaceIterator; + typedef Namespaces::const_iterator NamespaceIterator; NamespaceIterator namespace_begin () const @@ -39,7 +36,7 @@ namespace XSDFrontend } public: - Boolean + bool prototype_p () { return prototype_ != 0; @@ -52,7 +49,7 @@ namespace XSDFrontend return *prototype_; } - Void + void prototype (Any& a) { assert (prototype_ == 0); @@ -63,17 +60,15 @@ namespace XSDFrontend Namespace& definition_namespace (); - protected: - friend class Bits::Graph; - + public: Any (Path const& file, - UnsignedLong line, - UnsignedLong column, - WideString const& namespaces); + unsigned long line, + unsigned long column, + String const& namespaces); Any (Path const& file, - UnsignedLong line, - UnsignedLong column, + unsigned long line, + unsigned long column, NamespaceIterator begin, NamespaceIterator end); diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx index 54bb5df..f61fa39 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx @@ -1,39 +1,34 @@ // file : xsd-frontend/semantic-graph/attribute-group.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + AttributeGroup:: + AttributeGroup (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct AttributeGroupInit { AttributeGroupInit () { - TypeInfo ti (typeid (AttributeGroup)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (AttributeGroup)); + ti.add_base (typeid (Scope)); + insert (ti); } - } attribute_group_init_; } - - AttributeGroup:: - AttributeGroup (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx index 44739f2..62a1f81 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/attribute-group.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ATTRIBUTE_GROUP_HXX @@ -14,12 +13,10 @@ namespace XSDFrontend { class AttributeGroup: public virtual Scope { - protected: - friend class Bits::Graph; - + public: AttributeGroup (Path const& file, - UnsignedLong line, - UnsignedLong column); + unsigned long line, + unsigned long column); }; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx index 2e30d4e..624b16a 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx @@ -1,44 +1,41 @@ // file : xsd-frontend/semantic-graph/attribute.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + Attribute:: + Attribute (Path const& file, + unsigned long line, + unsigned long column, + bool optional, + bool global, + bool qualified) + : Node (file, line, column), + Member (global, qualified), + optional_ (optional) + { + } namespace { + using compiler::type_info; + struct AttributeInit { AttributeInit () { - TypeInfo ti (typeid (Attribute)); - ti.add_base (Access::public_, true, typeid (Member)); - RTTI::insert (ti); + type_info ti (typeid (Attribute)); + ti.add_base (typeid (Member)); + insert (ti); } - } attribute_init_; } - - Attribute:: - Attribute (Path const& file, - UnsignedLong line, - UnsignedLong column, - Boolean optional, - Boolean global, - Boolean qualified) - : Node (file, line, column), - Member (global, qualified), - optional_ (optional) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx index f7a516d..9d9b0fb 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/attribute.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ATTRIBUTE_HXX @@ -15,23 +14,21 @@ namespace XSDFrontend class Attribute: public virtual Member { public: - Boolean + bool optional_p () const { return optional_; } - protected: - friend class Bits::Graph; - + public: Attribute (Path const& file, - UnsignedLong line, - UnsignedLong column, - Boolean optional, - Boolean global, - Boolean qualified); + unsigned long line, + unsigned long column, + bool optional, + bool global, + bool qualified); private: - Boolean optional_; + bool optional_; }; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx index 0cc265f..8433a0e 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx @@ -1,34 +1,15 @@ // file : xsd-frontend/semantic-graph/complex.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct ComplexInit - { - ComplexInit () - { - TypeInfo ti (typeid (Complex)); - ti.add_base (Access::public_, true, typeid (Type)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); - } - - } complex_init_; - } - Complex:: Complex () : mixed_ (false), contains_compositor_ (0) @@ -36,10 +17,26 @@ namespace XSDFrontend } Complex:: - Complex (Path const& file, UnsignedLong line, UnsignedLong column) + Complex (Path const& file, unsigned long line, unsigned long column) : Node (file, line, column), mixed_ (false), contains_compositor_ (0) { } + + namespace + { + using compiler::type_info; + + struct ComplexInit + { + ComplexInit () + { + type_info ti (typeid (Complex)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Scope)); + insert (ti); + } + } complex_init_; + } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx index 40327bc..ac47810 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/complex.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPLEX_HXX @@ -9,8 +8,6 @@ #include #include -#include - namespace XSDFrontend { namespace SemanticGraph @@ -18,15 +15,27 @@ namespace XSDFrontend class Complex: public virtual Type, public virtual Scope { public: - Boolean + bool mixed_p () const { - return mixed_; + if (mixed_) + return true; + + // If we have empty content, then we have the same content + // type as our base. + // + if (!contains_compositor_p () && inherits_p ()) + { + if (Complex* b = dynamic_cast (&inherits ().base ())) + return b->mixed_p (); + } + + return false; } public: - Boolean - contains_compositor_p () + bool + contains_compositor_p () const { return contains_compositor_ != 0; } @@ -39,37 +48,37 @@ namespace XSDFrontend } public: - Void - mixed_p (Boolean m) + void + mixed_p (bool m) { mixed_ = m; } - protected: - friend class Bits::Graph; - - Complex (); // Virtual inheritance (Enumeration). - Complex (Path const& file, UnsignedLong line, UnsignedLong column); - - using Type::add_edge_right; - using Type::add_edge_left; - using Scope::add_edge_left; + public: + Complex (Path const& file, unsigned long line, unsigned long column); - Void + void add_edge_left (ContainsCompositor& e) { contains_compositor_ = &e; } - Void + void remove_edge_left (ContainsCompositor& e) { assert (contains_compositor_ == &e); contains_compositor_ = 0; } + using Type::add_edge_right; + using Type::add_edge_left; + using Scope::add_edge_left; + + protected: + Complex (); // For virtual inheritance (Enumeration). + private: - Boolean mixed_; + bool mixed_; ContainsCompositor* contains_compositor_; }; } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx index 08953bc..dd65e56 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx @@ -1,124 +1,100 @@ // file : xsd-frontend/semantic-graph/compositor.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // ContainsCompositor + // + ContainsCompositor:: + ContainsCompositor (unsigned long min, unsigned long max) + : compositor_ (0), container_ (0), min_ (min), max_ (max) + { + } - using RTTI::Access; - using RTTI::TypeInfo; + // All + // + All:: + All (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } + // Choice + // + Choice:: + Choice (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } - // ContainsCompositor + // Sequence // + Sequence:: + Sequence (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } + namespace { + using compiler::type_info; + struct ContainsCompositorInit { ContainsCompositorInit () { - TypeInfo ti (typeid (ContainsCompositor)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (ContainsCompositor)); + ti.add_base (typeid (Edge)); + insert (ti); } - } contains_compositor_init_; - } - ContainsCompositor:: - ContainsCompositor (UnsignedLong min, UnsignedLong max) - : compositor_ (0), container_ (0), min_ (min), max_ (max) - { - } - - // Compositor - // - namespace - { struct CompositorInit { CompositorInit () { - TypeInfo ti (typeid (Compositor)); - ti.add_base (Access::public_, true, typeid (Particle)); - RTTI::insert (ti); + type_info ti (typeid (Compositor)); + ti.add_base (typeid (Particle)); + insert (ti); } - } compositor_init_; - } - - // All - // - namespace - { struct AllInit { AllInit () { - TypeInfo ti (typeid (All)); - ti.add_base (Access::public_, true, typeid (Compositor)); - RTTI::insert (ti); + type_info ti (typeid (All)); + ti.add_base (typeid (Compositor)); + insert (ti); } - } all_init_; - } - All:: - All (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - - - // Choice - // - namespace - { struct ChoiceInit { ChoiceInit () { - TypeInfo ti (typeid (Choice)); - ti.add_base (Access::public_, true, typeid (Compositor)); - RTTI::insert (ti); + type_info ti (typeid (Choice)); + ti.add_base (typeid (Compositor)); + insert (ti); } - } choice_init_; - } - Choice:: - Choice (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - - // Sequence - // - namespace - { struct SequenceInit { SequenceInit () { - TypeInfo ti (typeid (Sequence)); - ti.add_base (Access::public_, true, typeid (Compositor)); - RTTI::insert (ti); + type_info ti (typeid (Sequence)); + ti.add_base (typeid (Compositor)); + insert (ti); } - } sequence_init_; } - - Sequence:: - Sequence (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx index c82d8a4..3573c24 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/semantic-graph/compositors.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX #define XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX -#include +#include #include #include @@ -33,43 +32,41 @@ namespace XSDFrontend } public: - UnsignedLong + unsigned long min () const { return min_; } - UnsignedLong + unsigned long max () const { return max_; } - protected: - friend class Bits::Graph; - - ContainsCompositor (UnsignedLong min, UnsignedLong max); + public: + ContainsCompositor (unsigned long min, unsigned long max); - Void + void set_left_node (Node& n) { container_ = &n; } - Void + void set_right_node (Compositor& n) { compositor_ = &n; } - Void + void clear_left_node (Node& n) { assert (container_ == &n); container_ = 0; } - Void + void clear_right_node (Compositor& n) { assert (compositor_ == &n); @@ -79,25 +76,19 @@ namespace XSDFrontend private: Compositor* compositor_; Node* container_; - UnsignedLong min_, max_; + unsigned long min_, max_; }; - // // class Compositor: public virtual Particle { - typedef - Cult::Containers::List - ContainsList; + typedef std::list ContainsList; public: + typedef pointer_iterator ContainsIterator; typedef - Bits::PointerIterator - ContainsIterator; - - typedef - Bits::PointerIterator + pointer_iterator ContainsConstIterator; ContainsIterator @@ -125,7 +116,7 @@ namespace XSDFrontend } public: - Boolean + bool contained_compositor_p () { return contained_compositor_ != 0; @@ -139,7 +130,7 @@ namespace XSDFrontend } public: - UnsignedLong + unsigned long min () const { if (contained_compositor_ != 0) @@ -148,7 +139,7 @@ namespace XSDFrontend return Particle::min (); } - UnsignedLong + unsigned long max () const { if (contained_compositor_ != 0) @@ -157,24 +148,31 @@ namespace XSDFrontend return Particle::max (); } - protected: - friend class Bits::Graph; + public: + Compositor (): contained_compositor_ (0) {} - Compositor () - : contained_compositor_ (0) + void + add_edge_left (ContainsParticle& e) { + contains_.push_back (&e); } - Void - add_edge_left (ContainsParticle& e) + void + add_edge_left (ContainsParticle& e, ContainsIterator const& after) { - contains_.push_back (&e); + if (after.base () == contains_.end ()) + contains_.push_front (&e); + else + { + ContainsList::iterator i (after.base ()); + contains_.insert (++i, &e); + } } - Void + void remove_edge_left (ContainsParticle& e) { - for (ContainsList::Iterator i (contains_.begin ()); + for (ContainsList::iterator i (contains_.begin ()); i != contains_.end (); ++i) { if (*i == &e) @@ -185,77 +183,50 @@ namespace XSDFrontend } } - //@@ Ideally should be protected but then NodeArg has no way to - // access it. Maybe when (if) I move NodeArg into Grpah I can - // resolve this. - // - public: - Void - add_edge_left (ContainsParticle& e, ContainsIterator const& after) - { - if (after.base () == contains_.end ()) - contains_.push_front (&e); - else - { - ContainsList::Iterator i (after.base ()); - contains_.insert (++i, &e); - } - } - - protected: - using Node::add_edge_right; - using Particle::add_edge_right; - using Particle::remove_edge_right; - - Void + void add_edge_right (ContainsCompositor& e) { contained_compositor_ = &e; } - Void + void remove_edge_right (ContainsCompositor& e) { assert (contained_compositor_ == &e); contained_compositor_ = 0; } + using Node::add_edge_right; + using Particle::add_edge_right; + using Particle::remove_edge_right; + private: ContainsList contains_; ContainsCompositor* contained_compositor_; }; - // // class All: public virtual Compositor { - protected: - friend class Bits::Graph; - - All (Path const& file, UnsignedLong line, UnsignedLong column); + public: + All (Path const& file, unsigned long line, unsigned long column); }; - // // class Choice: public virtual Compositor { - protected: - friend class Bits::Graph; - - Choice (Path const& file, UnsignedLong line, UnsignedLong column); + public: + Choice (Path const& file, unsigned long line, unsigned long column); }; - // // class Sequence: public virtual Compositor { - protected: - friend class Bits::Graph; - - Sequence (Path const& file, UnsignedLong line, UnsignedLong column); + public: + Sequence (Path const& file, unsigned long line, unsigned long column); }; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx index 0e71aa6..a02d751 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx @@ -1,38 +1,34 @@ // file : xsd-frontend/semantic-graph/element-group.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + ElementGroup:: + ElementGroup (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column), contains_compositor_ (0) + { + } namespace { + using compiler::type_info; + struct ElementGroupInit { ElementGroupInit () { - TypeInfo ti (typeid (ElementGroup)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (ElementGroup)); + ti.add_base (typeid (Scope)); + insert (ti); } - } element_group_init_; } - - ElementGroup:: - ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column), contains_compositor_ (0) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx index 23514b5..ee7772c 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/element-group.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_GROUP_HXX @@ -23,19 +22,17 @@ namespace XSDFrontend return *contains_compositor_; } - protected: - friend class Bits::Graph; - - ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column); - - using Scope::add_edge_left; + public: + ElementGroup (Path const& file, unsigned long line, unsigned long column); - Void + void add_edge_left (ContainsCompositor& e) { contains_compositor_ = &e; } + using Scope::add_edge_left; + private: ContainsCompositor* contains_compositor_; }; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx index 1d8cda5..fb7d3a7 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx @@ -1,63 +1,53 @@ // file : xsd-frontend/semantic-graph/element.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - - // Substitutes + // Element // + Element:: + Element (Path const& file, + unsigned long line, + unsigned long column, + bool global, + bool qualified) + : Node (file, line, column), + Member (global, qualified), + substitutes_ (0) + { + } + namespace { + using compiler::type_info; + struct SubstitutesInit { SubstitutesInit () { - TypeInfo ti (typeid (Substitutes)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Substitutes)); + ti.add_base (typeid (Edge)); + insert (ti); } - } substitutes_init_; - } - // Element - // - namespace - { struct ElementInit { ElementInit () { - TypeInfo ti (typeid (Element)); - ti.add_base (Access::public_, true, typeid (Member)); - ti.add_base (Access::public_, true, typeid (Particle)); - RTTI::insert (ti); + type_info ti (typeid (Element)); + ti.add_base (typeid (Member)); + ti.add_base (typeid (Particle)); + insert (ti); } - } element_init_; } - - Element:: - Element (Path const& file, - UnsignedLong line, - UnsignedLong column, - Boolean global, - Boolean qualified) - : Node (file, line, column), - Member (global, qualified), - substitutes_ (0) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx index e7046e4..0af164e 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/element.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_HXX @@ -30,20 +29,14 @@ namespace XSDFrontend return *root_; } - protected: - friend class Bits::Graph; - - Substitutes () - { - } - - Void + public: + void set_left_node (Element& n) { substitution_ = &n; } - Void + void set_right_node (Element& n) { root_ = &n; @@ -59,7 +52,7 @@ namespace XSDFrontend public virtual Particle { public: - Boolean + bool substitutes_p () const { return substitutes_ != 0; @@ -72,25 +65,21 @@ namespace XSDFrontend return *substitutes_; } - protected: - friend class Bits::Graph; - + public: Element (Path const& file, - UnsignedLong line, - UnsignedLong column, - Boolean global, - Boolean qualified); + unsigned long line, + unsigned long column, + bool global, + bool qualified); - Void + void add_edge_left (Substitutes& e) { substitutes_ = &e; } - Void - add_edge_right (Substitutes&) - { - } + void + add_edge_right (Substitutes&) {} using Member::add_edge_left; using Member::add_edge_right; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx index 6a2addf..fa48a9a 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx @@ -1,10 +1,11 @@ // file : xsd-frontend/semantic-graph/elements.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include +#include + #include #include @@ -24,32 +25,29 @@ namespace XSDFrontend // Type // - Void Type:: + void Type:: remove_edge_left (Arguments& a) { - ArgumentsSet::Iterator i (arguments_.find (&a)); + ArgumentsSet::iterator i (arguments_.find (&a)); assert (i != arguments_.end ()); arguments_.erase (i); } // Specialization // - Void Specialization:: + void Specialization:: remove_edge_right (Arguments& a) { // The number of entries should be small so linear search will do. // - Argumented::Iterator i ( + Argumented::iterator i ( std::find (argumented_.begin (), argumented_.end (), &a)); assert (i != argumented_.end ()); argumented_.erase (i); } - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + using compiler::type_info; namespace { @@ -59,209 +57,178 @@ namespace XSDFrontend { EdgeInit () { - TypeInfo ti (typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Edge)); + insert (ti); } - } edge_init_; - // Node // struct NodeInit { NodeInit () { - TypeInfo ti (typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Node)); + insert (ti); } - } node_init_; - // Names // struct NamesInit { NamesInit () { - TypeInfo ti (typeid (Names)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Names)); + ti.add_base (typeid (Edge)); + insert (ti); } - } names_init_; - // Nameable // struct NameableInit { NameableInit () { - TypeInfo ti (typeid (Nameable)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Nameable)); + ti.add_base (typeid (Node)); + insert (ti); } - } nameable_init_; - // Scope // struct ScopeInit { ScopeInit () { - TypeInfo ti (typeid (Scope)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); + type_info ti (typeid (Scope)); + ti.add_base (typeid (Nameable)); + insert (ti); } - } scope_init_; - // Type // struct TypeInit { TypeInit () { - TypeInfo ti (typeid (Type)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); + type_info ti (typeid (Type)); + ti.add_base (typeid (Nameable)); + insert (ti); } - } type_init_; - // Instance // struct InstanceInit { InstanceInit () { - TypeInfo ti (typeid (Instance)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); + type_info ti (typeid (Instance)); + ti.add_base (typeid (Nameable)); + insert (ti); } - } instance_init_; - // Belongs // struct BelongsInit { BelongsInit () { - TypeInfo ti (typeid (Belongs)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Belongs)); + ti.add_base (typeid (Edge)); + insert (ti); } - } belongs_init_; - - // Inherits // struct InheritsInit { InheritsInit () { - TypeInfo ti (typeid (Inherits)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Inherits)); + ti.add_base (typeid (Edge)); + insert (ti); } - } inherits_init_; - // Extends // struct ExtendsInit { ExtendsInit () { - TypeInfo ti (typeid (Extends)); - ti.add_base (Access::public_, true, typeid (Inherits)); - RTTI::insert (ti); + type_info ti (typeid (Extends)); + ti.add_base (typeid (Inherits)); + insert (ti); } - } extends_init_; - // Restricts // struct RestrictsInit { RestrictsInit () { - TypeInfo ti (typeid (Restricts)); - ti.add_base (Access::public_, true, typeid (Inherits)); - RTTI::insert (ti); + type_info ti (typeid (Restricts)); + ti.add_base (typeid (Inherits)); + insert (ti); } - } restricts_init_; - // BelongsToNamespace // struct BelongsToNamespaceInit { BelongsToNamespaceInit () { - TypeInfo ti (typeid (BelongsToNamespace)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (BelongsToNamespace)); + ti.add_base (typeid (Edge)); + insert (ti); } - } belongs_to_namespace_init_; - // Member // struct MemberInit { MemberInit () { - TypeInfo ti (typeid (Member)); - ti.add_base (Access::public_, true, typeid (Instance)); - RTTI::insert (ti); + type_info ti (typeid (Member)); + ti.add_base (typeid (Instance)); + insert (ti); } - } member_init_; - // Specialization // struct SpecializationInit { SpecializationInit () { - TypeInfo ti (typeid (Specialization)); - ti.add_base (Access::public_, true, typeid (Type)); - RTTI::insert (ti); + type_info ti (typeid (Specialization)); + ti.add_base (typeid (Type)); + insert (ti); } - } specialization_init_; - // Arguments // struct ArgumentsInit { ArgumentsInit () { - TypeInfo ti (typeid (Arguments)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Arguments)); + ti.add_base (typeid (Edge)); + insert (ti); } - } arguments_init_; - /* // Contains // @@ -269,64 +236,50 @@ namespace XSDFrontend { ContainsInit () { - TypeInfo ti (typeid (Contains)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Contains)); + ti.add_base (typeid (Edge)); + insert (ti); } - } contains_init_; - // Container // struct ContainerInit { ContainerInit () { - TypeInfo ti (typeid (Container)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Container)); + ti.add_base (typeid (Node)); + insert (ti); } - } container_init_; */ - // AnyType // - namespace + struct AnyTypeInit { - struct AnyTypeInit + AnyTypeInit () { - AnyTypeInit () - { - TypeInfo ti (typeid (AnyType)); - ti.add_base (Access::public_, true, typeid (SemanticGraph::Type)); - RTTI::insert (ti); - } - - } any_type_init_; - } - + type_info ti (typeid (AnyType)); + ti.add_base (typeid (SemanticGraph::Type)); + insert (ti); + } + } any_type_init_; // AnySimpleType // - namespace + struct AnySimpleTypeInit { - struct AnySimpleTypeInit + AnySimpleTypeInit () { - AnySimpleTypeInit () - { - TypeInfo ti (typeid (AnySimpleType)); - ti.add_base (Access::public_, true, typeid (Type)); - RTTI::insert (ti); - } - - } any_simple_type_init_; - } + type_info ti (typeid (AnySimpleType)); + ti.add_base (typeid (Type)); + insert (ti); + } + } any_simple_type_init_; } - // Instance // Type& Instance:: @@ -342,9 +295,5 @@ namespace XSDFrontend std::wostream& operator<< (std::wostream& os, XSDFrontend::SemanticGraph::Path const& path) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - return os << path.native_file_string ().c_str (); -#else return os << path.string ().c_str (); -#endif } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx index 78b6615..98fb180 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx @@ -1,171 +1,41 @@ // file : xsd-frontend/semantic-graph/elements.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENTS_HXX #define XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENTS_HXX +#include +#include +#include +#include #include +#include // std::pair +#include // abort +#include -#include -#include -#include +#include +#include +#include +#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include +#include namespace XSDFrontend { namespace SemanticGraph { - using namespace Cult::Types; - - namespace Bits - { - using Cult::Containers::Graph; - - //@@ Should end up in Cult::Meta - // - template - struct strip_pointer - { - typedef X Type; - }; - - template - struct strip_pointer - { - typedef X Type; - }; - - template - struct PointerIterator - { - typedef - typename strip_pointer::Type - Value; - - typedef I BaseIterator; - typedef Value& Reference; - typedef Value* Pointer; - - PointerIterator () - : i_ () // i_ can be of a pointer type. - { - } - - PointerIterator (I const& i) - : i_ (i) - { - } - - public: - Reference - operator* () const - { - return **i_; - } - - Pointer - operator-> () const - { - return *i_; - } - - I const& - base () const - { - return i_; - } - - public: - PointerIterator& - operator++ () - { - ++i_; - return *this; - } - - PointerIterator - operator++ (Int) - { - PointerIterator r (*this); - ++i_; - return r; - } - - PointerIterator& - operator-- () - { - --i_; - return *this; - } + using namespace cutl; - PointerIterator - operator-- (Int) - { - PointerIterator r (*this); - --i_; - return r; - } - - private: - I i_; - }; - - template - inline - Boolean - operator== (PointerIterator const& a, PointerIterator const& b) - { - return a.base () == b.base (); - } - - template - inline - Boolean - operator!= (PointerIterator const& a, PointerIterator const& b) - { - return a.base () != b.base (); - } - - template - inline - typename PointerIterator::BaseIterator::difference_type - operator- (PointerIterator const& a, PointerIterator const& b) - { - return a.base () - b.base (); - } - } + using container::pointer_iterator; // // - typedef - boost::filesystem::filesystem_error - InvalidPath; - - typedef - boost::filesystem::path - Path; + typedef fs::path Path; + typedef fs::invalid_path InvalidPath; + typedef std::vector Paths; - typedef - Cult::Containers::Vector - Paths; - - typedef - FrontendElements::Context - Context; + typedef compiler::context Context; // // @@ -195,24 +65,17 @@ namespace XSDFrontend public: template - Boolean + bool is_a () const { return dynamic_cast (this) != 0; } - protected: - friend class Bits::Graph; - - Edge () - { - } - private: mutable Context context_; }; - inline Boolean + inline bool operator== (Edge const& x, Edge const& y) { return &x == &y; @@ -237,20 +100,20 @@ namespace XSDFrontend return file_; } - UnsignedLong + unsigned long line () const { return line_; } - UnsignedLong + unsigned long column () const { return column_; } public: - Boolean + bool annotated_p () const { return annotates_ != 0; @@ -267,56 +130,54 @@ namespace XSDFrontend public: template - Boolean + bool is_a () const { return dynamic_cast (this) != 0; } public: - virtual - ~Node () - { - } + ~Node () {} - protected: - friend class Bits::Graph; - - Node (Path const& file, UnsignedLong line, UnsignedLong column) + Node (Path const& file, unsigned long line, unsigned long column) : annotates_ (0), file_ (file), line_ (line), column_ (column) { } - Node () // For virtual inheritance. + void + add_edge_right (Annotates& a) { - abort (); // Told you so! + annotates_ = &a; } - Void - add_edge_right (Annotates& a) + protected: + Node () // For virtual inheritance. { - annotates_ = &a; + abort (); // Told you so! } private: mutable Context context_; Annotates* annotates_; Path file_; - UnsignedLong line_; - UnsignedLong column_; + unsigned long line_; + unsigned long column_; }; - inline Boolean + inline bool operator== (Node const& x, Node const& y) { return &x == &y; } + // + // + typedef container::graph graph; // // - typedef WideString Name; + typedef String Name; // @@ -348,34 +209,29 @@ namespace XSDFrontend return *named_; } - protected: - friend class Bits::Graph; - - Names (Name const& name) - : name_ (name) - { - } + public: + Names (Name const& name): name_ (name) {} - Void + void set_left_node (Scope& n) { scope_ = &n; } - Void + void set_right_node (Nameable& n) { named_ = &n; } - Void + void clear_left_node (Scope& n) { assert (scope_ == &n); scope_ = 0; } - Void + void clear_right_node (Nameable& n) { assert (named_ == &n); @@ -392,7 +248,7 @@ namespace XSDFrontend class Nameable: public virtual Node { public: - Boolean + bool named_p () const { return named_ != 0; @@ -419,21 +275,16 @@ namespace XSDFrontend return *named_; } - protected: - friend class Bits::Graph; - - Nameable () - : named_ (0) - { - } + public: + Nameable (): named_ (0) {} - Void + void add_edge_right (Names& e) { named_ = &e; } - Void + void remove_edge_right (Names& e) { assert (named_ == &e); @@ -446,42 +297,25 @@ namespace XSDFrontend Names* named_; }; - // // - typedef - Cult::Containers::Set - Nameables; - + typedef std::set Nameables; // // class Scope: public virtual Nameable { protected: - typedef - Cult::Containers::List - NamesList; - - typedef - Cult::Containers::Map - ListIteratorMap; - - typedef - Cult::Containers::Map - NamesMap; + typedef std::list NamesList; + typedef std::map ListIteratorMap; + typedef std::map NamesMap; public: - typedef - Bits::PointerIterator - NamesIterator; - - typedef - Bits::PointerIterator - NamesConstIterator; + typedef pointer_iterator NamesIterator; + typedef pointer_iterator NamesConstIterator; typedef - Cult::Containers::Pair + std::pair NamesIteratorPair; NamesIterator @@ -511,7 +345,7 @@ namespace XSDFrontend virtual NamesIteratorPair find (Name const& name) const { - NamesMap::ConstIterator i (names_map_.find (name)); + NamesMap::const_iterator i (names_map_.find (name)); if (i == names_map_.end ()) return NamesIteratorPair (names_.end (), names_.end ()); @@ -522,42 +356,36 @@ namespace XSDFrontend NamesIterator find (Names& e) { - ListIteratorMap::Iterator i (iterator_map_.find (&e)); + ListIteratorMap::iterator i (iterator_map_.find (&e)); return i != iterator_map_.end () ? i->second : names_.end (); } - protected: - friend class Bits::Graph; - - Scope (Path const& file, UnsignedLong line, UnsignedLong column) + public: + Scope (Path const& file, unsigned long line, unsigned long column) : Node (file, line, column) { } - Scope () - { - } - - Void + void add_edge_left (Names& e) { - NamesList::Iterator i (names_.insert (names_.end (), &e)); + NamesList::iterator i (names_.insert (names_.end (), &e)); iterator_map_[&e] = i; names_map_[e.name ()].push_back (&e); } - Void + void remove_edge_left (Names& e) { - ListIteratorMap::Iterator i (iterator_map_.find (&e)); + ListIteratorMap::iterator i (iterator_map_.find (&e)); assert (i != iterator_map_.end ()); names_.erase (i->second); iterator_map_.erase (i); - NamesMap::Iterator j (names_map_.find (e.name ())); + NamesMap::iterator j (names_map_.find (e.name ())); - for (NamesList::Iterator i (j->second.begin ()); + for (NamesList::iterator i (j->second.begin ()); i != j->second.end (); ++i) { if (*i == &e) @@ -565,21 +393,16 @@ namespace XSDFrontend } } - //@@ Ideally should be protected but then NodeArg has no way to - // access it. Maybe when (if) I move NodeArg into Grpah I can - // resolve this. - // - public: - Void + void add_edge_left (Names& e, NamesIterator const& after) { - NamesList::Iterator i; + NamesList::iterator i; if (after.base () == names_.end ()) i = names_.insert (names_.begin (), &e); else { - NamesList::Iterator j (after.base ()); + NamesList::iterator j (after.base ()); i = names_.insert (++j, &e); } @@ -587,9 +410,11 @@ namespace XSDFrontend names_map_[e.name ()].push_back (&e); } - protected: using Nameable::add_edge_right; + protected: + Scope () {} + private: NamesList names_; ListIteratorMap iterator_map_; @@ -606,22 +431,12 @@ namespace XSDFrontend class Type: public virtual Nameable { protected: - typedef - Cult::Containers::Vector - Classifies; - - typedef - Cult::Containers::Vector - Begets; - - typedef - Cult::Containers::Set - ArgumentsSet; + typedef std::vector Classifies; + typedef std::vector Begets; + typedef std::set ArgumentsSet; public: - typedef - Bits::PointerIterator - ClassifiesIterator; + typedef pointer_iterator ClassifiesIterator; ClassifiesIterator classifies_begin () const @@ -637,7 +452,7 @@ namespace XSDFrontend // // - Boolean + bool inherits_p () const { return inherits_ != 0; @@ -652,9 +467,7 @@ namespace XSDFrontend // // - typedef - Bits::PointerIterator - BegetsIterator; + typedef pointer_iterator BegetsIterator; BegetsIterator begets_begin () const @@ -670,9 +483,7 @@ namespace XSDFrontend // // - typedef - Bits::PointerIterator - ArgumentsIterator; + typedef pointer_iterator ArgumentsIterator; ArgumentsIterator arguments_begin () const @@ -686,21 +497,16 @@ namespace XSDFrontend return arguments_.end (); } - protected: - friend class Bits::Graph; - - Type () - : inherits_ (0) - { - } + public: + Type (): inherits_ (0) {} - Void + void add_edge_right (Belongs& e) { classifies_.push_back (&e); } - Void + void add_edge_right (Inherits& e) { begets_.push_back (&e); @@ -708,16 +514,16 @@ namespace XSDFrontend using Nameable::add_edge_right; - Void + void add_edge_left (Arguments& a) { arguments_.insert (&a); } - Void + void remove_edge_left (Arguments&); - Void + void add_edge_left (Inherits& e) { inherits_ = &e; @@ -730,7 +536,6 @@ namespace XSDFrontend ArgumentsSet arguments_; }; - class Instance: public virtual Nameable { public: @@ -743,21 +548,16 @@ namespace XSDFrontend Type& type () const; - Boolean + bool typed_p () const { return belongs_ != 0; } - protected: - friend class Bits::Graph; - - Instance () - : belongs_ (0) - { - } + public: + Instance (): belongs_ (0) {} - Void + void add_edge_left (Belongs& e) { belongs_ = &e; @@ -783,20 +583,14 @@ namespace XSDFrontend return *type_; } - protected: - friend class Bits::Graph; - - Belongs () - { - } - - Void + public: + void set_left_node (Instance& n) { instance_ = &n; } - Void + void set_right_node (Type& n) { type_ = &n; @@ -825,20 +619,14 @@ namespace XSDFrontend return *derived_; } - protected: - friend class Bits::Graph; - - Inherits () - { - } - - Void + public: + void set_left_node (Type& n) { derived_ = &n; } - Void + void set_right_node (Type& n) { base_ = &n; @@ -849,30 +637,17 @@ namespace XSDFrontend Type* derived_; }; - class Extends: public virtual Inherits { - protected: - friend class Bits::Graph; - - Extends () - { - } }; class Restricts: public virtual Inherits { - protected: - typedef - Cult::Containers::Map - Facets; - public: - typedef - Facets::Iterator - FacetIterator; + typedef std::map Facets; + typedef Facets::iterator FacetIterator; - Boolean + bool facet_empty () { return facets_.empty (); @@ -891,22 +666,21 @@ namespace XSDFrontend } FacetIterator - facet_find (WideString const& name) + facet_find (String const& name) { return facets_.find (name); } - Void + void facet_insert (String const& name, String const& value) { facets_[name] = value; } - protected: - friend class Bits::Graph; - - Restricts () + Facets const& + facets () const { + return facets_; } protected: @@ -936,21 +710,16 @@ namespace XSDFrontend return *namespace__; } - protected: - friend class Bits::Graph; - - BelongsToNamespace () - : member_ (0), namespace__ (0) - { - } + public: + BelongsToNamespace (): member_ (0), namespace__ (0) {} - Void + void set_left_node (Member& n) { member_ = &n; } - Void + void set_right_node (Namespace& n) { namespace__ = &n; @@ -969,13 +738,13 @@ namespace XSDFrontend // Member is global either if it is defined outside any type // or it is a ref="" of a global member. // - Boolean + bool global_p () const { return global_; } - Boolean + bool qualified_p () const { return qualified_; @@ -995,13 +764,13 @@ namespace XSDFrontend // is a superset of the default value semantics. As such setting the // fixed value appears as if the default value was also set. // - Boolean + bool default_p () const { return value_type_ != ValueType::none; } - Boolean + bool fixed_p () const { return value_type_ == ValueType::fixed; @@ -1009,7 +778,7 @@ namespace XSDFrontend struct NoValue {}; - WideString + String value () const { if (value_type_ != ValueType::none) @@ -1020,24 +789,22 @@ namespace XSDFrontend // // - Void - default_ (WideString const& v) + void + default_ (String const& v) { value_ = v; value_type_ = ValueType::default_; } - Void - fixed (WideString const& v) + void + fixed (String const& v) { value_ = v; value_type_ = ValueType::fixed; } - protected: - friend class Bits::Graph; - - Member (Boolean global, Boolean qualified) + public: + Member (bool global, bool qualified) : global_ (global), qualified_ (qualified), belongs_to_namespace_ (0), @@ -1045,7 +812,7 @@ namespace XSDFrontend { } - Void + void add_edge_left (BelongsToNamespace& e) { // In the parser we sometimes re-add the same adge. @@ -1056,8 +823,8 @@ namespace XSDFrontend using Instance::add_edge_left; private: - Boolean global_; - Boolean qualified_; + bool global_; + bool qualified_; BelongsToNamespace* belongs_to_namespace_; struct ValueType @@ -1070,7 +837,7 @@ namespace XSDFrontend }; }; - WideString value_; + String value_; ValueType::Value value_type_; }; @@ -1080,17 +847,12 @@ namespace XSDFrontend class Specialization: public virtual Type { - typedef - Cult::Containers::Vector - Argumented; + typedef std::vector Argumented; public: + typedef pointer_iterator ArgumentedIterator; typedef - Bits::PointerIterator - ArgumentedIterator; - - typedef - Bits::PointerIterator + pointer_iterator ArgumentedConstIterator; ArgumentedIterator @@ -1125,32 +887,28 @@ namespace XSDFrontend return *argumented_[0]; } - protected: - friend class Bits::Graph; - + public: using Type::add_edge_right; - Void + void add_edge_right (Arguments& a) { argumented_.push_back (&a); } - Void - remove_edge_right (Arguments&); - - public: - Void + void add_edge_right (Arguments& a, ArgumentedIterator const& pos) { argumented_.insert (pos.base (), &a); } + void + remove_edge_right (Arguments&); + private: Argumented argumented_; }; - class Arguments: public virtual Edge { public: @@ -1166,9 +924,7 @@ namespace XSDFrontend return *specialization_; } - protected: - friend class Bits::Graph; - + public: void set_left_node (Type& n) { @@ -1205,17 +961,14 @@ namespace XSDFrontend // class AnyType: public virtual Type { - protected: - friend class Bits::Graph; - - AnyType (Path const& file, UnsignedLong line, UnsignedLong column) + public: + AnyType (Path const& file, unsigned long line, unsigned long column) : Node (file, line, column) { } - AnyType () // For virtual inheritance. - { - } + protected: + AnyType () {} // For virtual inheritance. }; @@ -1223,17 +976,14 @@ namespace XSDFrontend // class AnySimpleType: public virtual Type { - protected: - friend class Bits::Graph; - - AnySimpleType (Path const& file, UnsignedLong line, UnsignedLong column) + public: + AnySimpleType (Path const& file, unsigned long line, unsigned long column) : Node (file, line, column) { } - AnySimpleType () // For virtual inheritance. - { - } + protected: + AnySimpleType () {} // For virtual inheritance. }; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx index adcf71e..93bcf79 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx @@ -1,32 +1,45 @@ // file : xsd-frontend/semantic-graph/enumeration.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // Enumeration + // + Enumeration:: + Enumeration (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } - using RTTI::Access; - using RTTI::TypeInfo; + // Enumerator + // + Enumerator:: + Enumerator (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + // Enumeration // struct EnumerationInit { EnumerationInit () { - TypeInfo ti (typeid (Enumeration)); - ti.add_base (Access::public_, true, typeid (Complex)); - RTTI::insert (ti); + type_info ti (typeid (Enumeration)); + ti.add_base (typeid (Complex)); + insert (ti); } - } enumeration_init_; @@ -36,32 +49,11 @@ namespace XSDFrontend { EnumeratorInit () { - TypeInfo ti (typeid (Enumerator)); - ti.add_base (Access::public_, true, typeid (Instance)); - RTTI::insert (ti); + type_info ti (typeid (Enumerator)); + ti.add_base (typeid (Instance)); + insert (ti); } - } enumerator_init_; } - - - // Enumeration - // - - Enumeration:: - Enumeration (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - - - // Enumerator - // - - Enumerator:: - Enumerator (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx index a21e8f3..90a33d1 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/enumeration.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ENUMERATION_HXX @@ -15,19 +14,15 @@ namespace XSDFrontend { class Enumeration: public virtual Complex { - protected: - friend class Bits::Graph; - - Enumeration (Path const& file, UnsignedLong line, UnsignedLong column); + public: + Enumeration (Path const& file, unsigned long line, unsigned long column); }; class Enumerator: public virtual Instance { - protected: - friend class Bits::Graph; - - Enumerator (Path const& file, UnsignedLong line, UnsignedLong column); + public: + Enumerator (Path const& file, unsigned long line, unsigned long column); }; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx new file mode 100644 index 0000000..cc98449 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx @@ -0,0 +1,1143 @@ +// file : xsd-frontend/semantic-graph/fundamental.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Note, that this file is automatically generated! +// + +#include + +#include + +namespace XSDFrontend +{ + namespace SemanticGraph + { + namespace Fundamental + { + using compiler::type_info; + + // Type + // + namespace + { + struct TypeInit + { + TypeInit () + { + type_info ti (typeid (Type)); + ti.add_base (typeid (SemanticGraph::Type)); + insert (ti); + } + } any_type_init_; + } + + Type:: + Type () + { + } + + + // Byte + // + namespace + { + struct ByteInit + { + ByteInit () + { + type_info ti (typeid (Byte)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } byte_init_; + } + + Byte:: + Byte (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // UnsignedByte + // + namespace + { + struct UnsignedByteInit + { + UnsignedByteInit () + { + type_info ti (typeid (UnsignedByte)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } unsigned_byte_init_; + } + + UnsignedByte:: + UnsignedByte (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Short + // + namespace + { + struct ShortInit + { + ShortInit () + { + type_info ti (typeid (Short)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } short_init_; + } + + Short:: + Short (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // UnsignedShort + // + namespace + { + struct UnsignedShortInit + { + UnsignedShortInit () + { + type_info ti (typeid (UnsignedShort)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } unsigned_short_init_; + } + + UnsignedShort:: + UnsignedShort (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Int + // + namespace + { + struct IntInit + { + IntInit () + { + type_info ti (typeid (Int)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } int_init_; + } + + Int:: + Int (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // UnsignedInt + // + namespace + { + struct UnsignedIntInit + { + UnsignedIntInit () + { + type_info ti (typeid (UnsignedInt)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } unsigned_int_init_; + } + + UnsignedInt:: + UnsignedInt (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Long + // + namespace + { + struct LongInit + { + LongInit () + { + type_info ti (typeid (Long)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } long_init_; + } + + Long:: + Long (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // UnsignedLong + // + namespace + { + struct UnsignedLongInit + { + UnsignedLongInit () + { + type_info ti (typeid (UnsignedLong)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } unsigned_long_init_; + } + + UnsignedLong:: + UnsignedLong (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Integer + // + namespace + { + struct IntegerInit + { + IntegerInit () + { + type_info ti (typeid (Integer)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } integer_init_; + } + + Integer:: + Integer (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // NonPositiveInteger + // + namespace + { + struct NonPositiveIntegerInit + { + NonPositiveIntegerInit () + { + type_info ti (typeid (NonPositiveInteger)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } non_positive_integer_init_; + } + + NonPositiveInteger:: + NonPositiveInteger (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // NonNegativeInteger + // + namespace + { + struct NonNegativeIntegerInit + { + NonNegativeIntegerInit () + { + type_info ti (typeid (NonNegativeInteger)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } non_negative_integer_init_; + } + + NonNegativeInteger:: + NonNegativeInteger (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // PositiveInteger + // + namespace + { + struct PositiveIntegerInit + { + PositiveIntegerInit () + { + type_info ti (typeid (PositiveInteger)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } positive_integer_init_; + } + + PositiveInteger:: + PositiveInteger (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // NegativeInteger + // + namespace + { + struct NegativeIntegerInit + { + NegativeIntegerInit () + { + type_info ti (typeid (NegativeInteger)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } negative_integer_init_; + } + + NegativeInteger:: + NegativeInteger (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Boolean + // + namespace + { + struct BooleanInit + { + BooleanInit () + { + type_info ti (typeid (Boolean)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } boolean_init_; + } + + Boolean:: + Boolean (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Float + // + namespace + { + struct FloatInit + { + FloatInit () + { + type_info ti (typeid (Float)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } float_init_; + } + + Float:: + Float (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Double + // + namespace + { + struct DoubleInit + { + DoubleInit () + { + type_info ti (typeid (Double)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } double_init_; + } + + Double:: + Double (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Decimal + // + namespace + { + struct DecimalInit + { + DecimalInit () + { + type_info ti (typeid (Decimal)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } decimal_init_; + } + + Decimal:: + Decimal (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // String + // + namespace + { + struct StringInit + { + StringInit () + { + type_info ti (typeid (String)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } string_init_; + } + + String:: + String (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // NormalizedString + // + namespace + { + struct NormalizedStringInit + { + NormalizedStringInit () + { + type_info ti (typeid (NormalizedString)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } normalized_string_init_; + } + + NormalizedString:: + NormalizedString (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Token + // + namespace + { + struct TokenInit + { + TokenInit () + { + type_info ti (typeid (Token)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } token_init_; + } + + Token:: + Token (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Name + // + namespace + { + struct NameInit + { + NameInit () + { + type_info ti (typeid (Name)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } name_init_; + } + + Name:: + Name (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // NameToken + // + namespace + { + struct NameTokenInit + { + NameTokenInit () + { + type_info ti (typeid (NameToken)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } name_token_init_; + } + + NameToken:: + NameToken (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // NameTokens + // + namespace + { + struct NameTokensInit + { + NameTokensInit () + { + type_info ti (typeid (NameTokens)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } name_tokens_init_; + } + + NameTokens:: + NameTokens (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // NCName + // + namespace + { + struct NCNameInit + { + NCNameInit () + { + type_info ti (typeid (NCName)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } NC_name_init_; + } + + NCName:: + NCName (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Language + // + namespace + { + struct LanguageInit + { + LanguageInit () + { + type_info ti (typeid (Language)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } language_init_; + } + + Language:: + Language (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // QName + // + namespace + { + struct QNameInit + { + QNameInit () + { + type_info ti (typeid (QName)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } q_name_init_; + } + + QName:: + QName (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Id + // + namespace + { + struct IdInit + { + IdInit () + { + type_info ti (typeid (Id)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } id_init_; + } + + Id:: + Id (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // IdRef + // + namespace + { + struct IdRefInit + { + IdRefInit () + { + type_info ti (typeid (IdRef)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Specialization)); + insert (ti); + } + + } id_ref_init_; + } + + IdRef:: + IdRef (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // IdRefs + // + namespace + { + struct IdRefsInit + { + IdRefsInit () + { + type_info ti (typeid (IdRefs)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Specialization)); + insert (ti); + } + + } id_refs_init_; + } + + IdRefs:: + IdRefs (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // AnyURI + // + namespace + { + struct AnyURIInit + { + AnyURIInit () + { + type_info ti (typeid (AnyURI)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } any_URI_init_; + } + + AnyURI:: + AnyURI (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Base64Binary + // + namespace + { + struct Base64BinaryInit + { + Base64BinaryInit () + { + type_info ti (typeid (Base64Binary)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } base_64_binary_init_; + } + + Base64Binary:: + Base64Binary (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // HexBinary + // + namespace + { + struct HexBinaryInit + { + HexBinaryInit () + { + type_info ti (typeid (HexBinary)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } hex_binary_init_; + } + + HexBinary:: + HexBinary (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Date + // + namespace + { + struct DateInit + { + DateInit () + { + type_info ti (typeid (Date)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } date_init_; + } + + Date:: + Date (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // DateTime + // + namespace + { + struct DateTimeInit + { + DateTimeInit () + { + type_info ti (typeid (DateTime)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } date_time_init_; + } + + DateTime:: + DateTime (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Duration + // + namespace + { + struct DurationInit + { + DurationInit () + { + type_info ti (typeid (Duration)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } duration_init_; + } + + Duration:: + Duration (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Day + // + namespace + { + struct DayInit + { + DayInit () + { + type_info ti (typeid (Day)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } day_init_; + } + + Day:: + Day (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Month + // + namespace + { + struct MonthInit + { + MonthInit () + { + type_info ti (typeid (Month)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } month_init_; + } + + Month:: + Month (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // MonthDay + // + namespace + { + struct MonthDayInit + { + MonthDayInit () + { + type_info ti (typeid (MonthDay)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } month_day_init_; + } + + MonthDay:: + MonthDay (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Year + // + namespace + { + struct YearInit + { + YearInit () + { + type_info ti (typeid (Year)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } year_init_; + } + + Year:: + Year (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // YearMonth + // + namespace + { + struct YearMonthInit + { + YearMonthInit () + { + type_info ti (typeid (YearMonth)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } year_month_init_; + } + + YearMonth:: + YearMonth (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Time + // + namespace + { + struct TimeInit + { + TimeInit () + { + type_info ti (typeid (Time)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } time_init_; + } + + Time:: + Time (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Entity + // + namespace + { + struct EntityInit + { + EntityInit () + { + type_info ti (typeid (Entity)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } entity_init_; + } + + Entity:: + Entity (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Entities + // + namespace + { + struct EntitiesInit + { + EntitiesInit () + { + type_info ti (typeid (Entities)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } entities_init_; + } + + Entities:: + Entities (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + + + // Notation + // + namespace + { + struct NotationInit + { + NotationInit () + { + type_info ti (typeid (Notation)); + ti.add_base (typeid (Type)); + insert (ti); + } + + } notation_init_; + } + + Notation:: + Notation (Path const& file, + unsigned long line, + unsigned long column) + : Node (file, line, column) + { + } + } + } +} diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 index cc1316c..c336ab8 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 @@ -1,8 +1,7 @@ divert(-1) # file : xsd-frontend/semantic-graph/fundamental.cxx.m4 -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include(`fundamental.m4') @@ -21,9 +20,9 @@ define(`fundamental_type_impl', ` { $1Init () { - TypeInfo ti (typeid ($1)); - ti.add_base (Access::public_, true, typeid (Type)); - RTTI::insert (ti); + type_info ti (typeid ($1)); + ti.add_base (typeid (Type)); + insert (ti); } } $2_init_; @@ -31,8 +30,8 @@ define(`fundamental_type_impl', ` $1:: $1 (Path const& file, - SemanticGraph::UnsignedLong line, - SemanticGraph::UnsignedLong column) + unsigned long line, + unsigned long column) : Node (file, line, column) { }') @@ -42,13 +41,14 @@ dnl dnl dnl // file : xsd-frontend/semantic-graph/fundamental.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file // Note, that this file is automatically generated! // +#include + #include namespace XSDFrontend @@ -57,11 +57,7 @@ namespace XSDFrontend { namespace Fundamental { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + using compiler::type_info; // Type // @@ -71,11 +67,10 @@ namespace XSDFrontend { TypeInit () { - TypeInfo ti (typeid (Type)); - ti.add_base (Access::public_, true, typeid (SemanticGraph::Type)); - RTTI::insert (ti); + type_info ti (typeid (Type)); + ti.add_base (typeid (SemanticGraph::Type)); + insert (ti); } - } any_type_init_; } @@ -138,10 +133,10 @@ fundamental_type(`id') { IdRefInit () { - TypeInfo ti (typeid (IdRef)); - ti.add_base (Access::public_, true, typeid (Type)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (IdRef)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Specialization)); + insert (ti); } } id_ref_init_; @@ -149,8 +144,8 @@ fundamental_type(`id') IdRef:: IdRef (Path const& file, - SemanticGraph::UnsignedLong line, - SemanticGraph::UnsignedLong column) + unsigned long line, + unsigned long column) : Node (file, line, column) { } @@ -164,10 +159,10 @@ fundamental_type(`id') { IdRefsInit () { - TypeInfo ti (typeid (IdRefs)); - ti.add_base (Access::public_, true, typeid (Type)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (IdRefs)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Specialization)); + insert (ti); } } id_refs_init_; @@ -175,8 +170,8 @@ fundamental_type(`id') IdRefs:: IdRefs (Path const& file, - SemanticGraph::UnsignedLong line, - SemanticGraph::UnsignedLong column) + unsigned long line, + unsigned long column) : Node (file, line, column) { } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx new file mode 100644 index 0000000..d810824 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx @@ -0,0 +1,516 @@ +// file : xsd-frontend/semantic-graph/fundamental.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Note, that this file is automatically generated! +// + +#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX +#define XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX + +#include + +namespace XSDFrontend +{ + namespace SemanticGraph + { + namespace Fundamental + { + // + // + class Type: public virtual SemanticGraph::Type + { + protected: + Type (); + }; + + + // + // + class Byte: public virtual Type + { + public: + Byte (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class UnsignedByte: public virtual Type + { + public: + UnsignedByte (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Short: public virtual Type + { + public: + Short (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class UnsignedShort: public virtual Type + { + public: + UnsignedShort (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Int: public virtual Type + { + public: + Int (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class UnsignedInt: public virtual Type + { + public: + UnsignedInt (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Long: public virtual Type + { + public: + Long (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class UnsignedLong: public virtual Type + { + public: + UnsignedLong (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Integer: public virtual Type + { + public: + Integer (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class NonPositiveInteger: public virtual Type + { + public: + NonPositiveInteger (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class NonNegativeInteger: public virtual Type + { + public: + NonNegativeInteger (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class PositiveInteger: public virtual Type + { + public: + PositiveInteger (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class NegativeInteger: public virtual Type + { + public: + NegativeInteger (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Boolean: public virtual Type + { + public: + Boolean (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Float: public virtual Type + { + public: + Float (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Double: public virtual Type + { + public: + Double (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Decimal: public virtual Type + { + public: + Decimal (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class String: public virtual Type + { + public: + String (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class NormalizedString: public virtual Type + { + public: + NormalizedString (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Token: public virtual Type + { + public: + Token (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Name: public virtual Type + { + public: + Name (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class NameToken: public virtual Type + { + public: + NameToken (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class NameTokens: public virtual Type + { + public: + NameTokens (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class NCName: public virtual Type + { + public: + NCName (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Language: public virtual Type + { + public: + Language (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class QName: public virtual Type + { + public: + QName (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Id: public virtual Type + { + public: + Id (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class IdRef: public virtual Type, + public virtual Specialization + { + public: + IdRef (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class IdRefs: public virtual Type, + public virtual Specialization + { + public: + IdRefs (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class AnyURI: public virtual Type + { + public: + AnyURI (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Base64Binary: public virtual Type + { + public: + Base64Binary (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class HexBinary: public virtual Type + { + public: + HexBinary (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Date: public virtual Type + { + public: + Date (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class DateTime: public virtual Type + { + public: + DateTime (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Duration: public virtual Type + { + public: + Duration (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Day: public virtual Type + { + public: + Day (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Month: public virtual Type + { + public: + Month (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class MonthDay: public virtual Type + { + public: + MonthDay (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Year: public virtual Type + { + public: + Year (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class YearMonth: public virtual Type + { + public: + YearMonth (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Time: public virtual Type + { + public: + Time (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Entity: public virtual Type + { + public: + Entity (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Entities: public virtual Type + { + public: + Entities (Path const& file, + unsigned long line, + unsigned long column); + }; + + + // + // + class Notation: public virtual Type + { + public: + Notation (Path const& file, + unsigned long line, + unsigned long column); + }; + } + } +} + +#endif // XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 index f5a88a9..52c9c89 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 @@ -1,8 +1,7 @@ divert(-1) # file : xsd-frontend/semantic-graph/fundamental.hxx.m4 -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include(`fundamental.m4') @@ -15,20 +14,17 @@ define(`fundamental_type_impl', ` // class $1: public virtual Type { - protected: - friend class Bits::Graph; - + public: $1 (Path const& file, - SemanticGraph::UnsignedLong line, - SemanticGraph::UnsignedLong column); + unsigned long line, + unsigned long column); };') divert(0)dnl dnl dnl dnl // file : xsd-frontend/semantic-graph/fundamental.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file // Note, that this file is automatically generated! @@ -50,8 +46,6 @@ namespace XSDFrontend class Type: public virtual SemanticGraph::Type { protected: - friend class Bits::Graph; - Type (); }; dnl @@ -106,12 +100,10 @@ fundamental_type(`id') class IdRef: public virtual Type, public virtual Specialization { - protected: - friend class Bits::Graph; - + public: IdRef (Path const& file, - SemanticGraph::UnsignedLong line, - SemanticGraph::UnsignedLong column); + unsigned long line, + unsigned long column); }; @@ -120,12 +112,10 @@ fundamental_type(`id') class IdRefs: public virtual Type, public virtual Specialization { - protected: - friend class Bits::Graph; - + public: IdRefs (Path const& file, - SemanticGraph::UnsignedLong line, - SemanticGraph::UnsignedLong column); + unsigned long line, + unsigned long column); }; dnl dnl URI. diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 index 735b35d..b9243f7 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 @@ -1,6 +1,5 @@ # file : xsd-frontend/semantic-graph/fundamental.m4 -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file define(`upcase', `translit(`$*', `a-z', `A-Z')') diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx index 3184041..f62f617 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx @@ -1,37 +1,34 @@ // file : xsd-frontend/semantic-graph/list.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + List:: + List (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct ListInit { ListInit () { - TypeInfo ti (typeid (List)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (List)); + ti.add_base (typeid (Specialization)); + insert (ti); } - } list_init_; } - - List:: - List (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx index 3ba0c02..d7f370f 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/list.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_LIST_HXX @@ -14,10 +13,8 @@ namespace XSDFrontend { class List: public virtual Specialization { - protected: - friend class Bits::Graph; - - List (Path const& file, UnsignedLong line, UnsignedLong column); + public: + List (Path const& file, unsigned long line, unsigned long column); }; } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx index 789b5d8..e33a892 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx @@ -1,37 +1,34 @@ // file : xsd-frontend/semantic-graph/namespace.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + Namespace:: + Namespace (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct NamespaceInit { NamespaceInit () { - TypeInfo ti (typeid (Namespace)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (Namespace)); + ti.add_base (typeid (Scope)); + insert (ti); } - } namespace_init_; } - - Namespace:: - Namespace (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx index 25bd1c0..ccc9d61 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/namespace.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_NAMESPACE_HXX @@ -14,15 +13,11 @@ namespace XSDFrontend { class Namespace : public virtual Scope { - protected: - friend class Bits::Graph; + public: + Namespace (Path const& file, unsigned long line, unsigned long column); - Namespace (Path const& file, UnsignedLong line, UnsignedLong column); - - Void - add_edge_right (BelongsToNamespace&) - { - } + void + add_edge_right (BelongsToNamespace&) {} using Scope::add_edge_right; }; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx index f8c93de..c3269e6 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx @@ -1,61 +1,54 @@ // file : xsd-frontend/semantic-graph/particle.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - // ContainsParticle // - namespace - { - struct ContainsParticleInit - { - ContainsParticleInit () - { - TypeInfo ti (typeid (ContainsParticle)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); - } - - } contains_particle_init_; - } - ContainsParticle:: - ContainsParticle (UnsignedLong min, UnsignedLong max) + ContainsParticle (unsigned long min, unsigned long max) : particle_ (0), compositor_ (0), min_ (min), max_ (max) { } // Particle // + Particle:: + Particle () + : contained_particle_ (0) + { + } + namespace { + using compiler::type_info; + + struct ContainsParticleInit + { + ContainsParticleInit () + { + type_info ti (typeid (ContainsParticle)); + ti.add_base (typeid (Edge)); + insert (ti); + } + } contains_particle_init_; + struct ParticleInit { ParticleInit () { - TypeInfo ti (typeid (Particle)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Particle)); + ti.add_base (typeid (Node)); + insert (ti); } - } particle_init_; } - - Particle:: - Particle () - : contained_particle_ (0) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx index df48de4..a7f0755 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/particle.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_PARTICLE_HXX @@ -36,43 +35,41 @@ namespace XSDFrontend } public: - UnsignedLong + unsigned long min () const { return min_; } - UnsignedLong + unsigned long max () const { return max_; } - protected: - friend class Bits::Graph; - - ContainsParticle (UnsignedLong min, UnsignedLong max); + public: + ContainsParticle (unsigned long min, unsigned long max); - Void + void set_left_node (Compositor& n) { compositor_ = &n; } - Void + void set_right_node (Particle& n) { particle_ = &n; } - Void + void clear_left_node (Compositor& n) { assert (compositor_ == &n); compositor_ = 0; } - Void + void clear_right_node (Particle& n) { assert (particle_ == &n); @@ -82,7 +79,7 @@ namespace XSDFrontend private: Particle* particle_; Compositor* compositor_; - UnsignedLong min_, max_; + unsigned long min_, max_; }; // @@ -90,7 +87,7 @@ namespace XSDFrontend class Particle: public virtual Node { public: - Boolean + bool contained_particle_p () { return contained_particle_ != 0; @@ -104,32 +101,30 @@ namespace XSDFrontend } public: - UnsignedLong + unsigned long min () const { assert (contained_particle_ != 0); return contained_particle_->min (); } - UnsignedLong + unsigned long max () const { assert (contained_particle_ != 0); return contained_particle_->max (); } - protected: - friend class Bits::Graph; - + public: Particle (); - Void + void add_edge_right (ContainsParticle& e) { contained_particle_ = &e; } - Void + void remove_edge_right (ContainsParticle& e) { assert (contained_particle_ == &e); diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx index f812797..d1cbf25 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx @@ -1,32 +1,64 @@ // file : xsd-frontend/semantic-graph/schema.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // Schema + // + Schema::NamesIteratorPair Schema:: + find (Name const& name) const + { + // Here we are going to create an illusion that the namespace + // hierarchy is flat. + names_.clear (); + schemas_.clear (); + + find_ (name, names_, schemas_); + + return NamesIteratorPair (NamesConstIterator (names_.begin ()), + NamesConstIterator (names_.end ())); + } + + void Schema:: + find_ (Name const& name, NamesList& names, SchemaSet& set) const + { + set.insert (this); + + // Check our own namespace first so it will end up first in the list. + // + NamesIteratorPair pair (Scope::find (name)); + names.insert (names.end (), pair.first.base (), pair.second.base ()); - using RTTI::Access; - using RTTI::TypeInfo; + for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i) + { + Schema& s (i->schema ()); + + if (set.find (&s) == set.end ()) + s.find_ (name, names, set); + } + } namespace { + using compiler::type_info; + // Uses // struct UsesInit { UsesInit () { - TypeInfo ti (typeid (Uses)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Uses)); + ti.add_base (typeid (Edge)); + insert (ti); } - } uses_init_; @@ -36,11 +68,10 @@ namespace XSDFrontend { ImpliesInit () { - TypeInfo ti (typeid (Implies)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Implies)); + ti.add_base (typeid (Uses)); + insert (ti); } - } implies_init_; @@ -50,11 +81,10 @@ namespace XSDFrontend { SourcesInit () { - TypeInfo ti (typeid (Sources)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Sources)); + ti.add_base (typeid (Uses)); + insert (ti); } - } sources_init_; @@ -64,11 +94,10 @@ namespace XSDFrontend { IncludesInit () { - TypeInfo ti (typeid (Includes)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Includes)); + ti.add_base (typeid (Uses)); + insert (ti); } - } includes_init_; @@ -78,11 +107,10 @@ namespace XSDFrontend { ImportsInit () { - TypeInfo ti (typeid (Imports)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Imports)); + ti.add_base (typeid (Uses)); + insert (ti); } - } imports_init_; @@ -92,48 +120,11 @@ namespace XSDFrontend { SchemaInit () { - TypeInfo ti (typeid (Schema)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (Schema)); + ti.add_base (typeid (Scope)); + insert (ti); } - } schema_init_; } - - - // Schema - // - Schema::NamesIteratorPair Schema:: - find (Name const& name) const - { - // Here we are going to create an illusion that the namespace - // hierarchy is flat. - names_.clear (); - schemas_.clear (); - - find_ (name, names_, schemas_); - - return NamesIteratorPair (NamesConstIterator (names_.begin ()), - NamesConstIterator (names_.end ())); - } - - Void Schema:: - find_ (Name const& name, NamesList& names, SchemaSet& set) const - { - set.insert (this); - - // Check our own namespace first so it will end up first in the list. - // - NamesIteratorPair pair (Scope::find (name)); - names.insert (names.end (), pair.first.base (), pair.second.base ()); - - for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i) - { - Schema& s (i->schema ()); - - if (set.find (&s) == set.end ()) - s.find_ (name, names, set); - } - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx index 10d2f75..803c870 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx @@ -1,12 +1,12 @@ // file : xsd-frontend/semantic-graph/schema.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX #define XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX -#include +#include +#include #include #include @@ -15,11 +15,8 @@ namespace XSDFrontend { namespace SemanticGraph { - // - // class Schema; - class Uses: public virtual Edge { public: @@ -41,21 +38,16 @@ namespace XSDFrontend return path_; } - protected: - friend class Bits::Graph; - - Uses (Path const& path) - : path_ (path) - { - } + public: + Uses (Path const& path): path_ (path) {} - Void + void set_left_node (Schema& s) { user_ = &s; } - Void + void set_right_node (Schema& s) { schema_ = &s; @@ -72,13 +64,8 @@ namespace XSDFrontend // class Implies: public virtual Uses { - protected: - friend class Bits::Graph; - - Implies (Path const& path) - : Uses (path) - { - } + public: + Implies (Path const& path): Uses (path) {} }; @@ -86,13 +73,8 @@ namespace XSDFrontend // class Sources: public virtual Uses { - protected: - friend class Bits::Graph; - - Sources (Path const& path) - : Uses (path) - { - } + public: + Sources (Path const& path): Uses (path) {} }; @@ -100,13 +82,8 @@ namespace XSDFrontend // class Includes: public virtual Uses { - protected: - friend class Bits::Graph; - - Includes (Path const& path) - : Uses (path) - { - } + public: + Includes (Path const& path): Uses (path) {} }; @@ -114,40 +91,29 @@ namespace XSDFrontend // class Imports: public virtual Uses { - protected: - friend class Bits::Graph; - - Imports (Path const& path) - : Uses (path) - { - } + public: + Imports (Path const& path): Uses (path) {} }; - // // - class Schema: public virtual Scope, - private Bits::Graph, - public NonCopyable + class Schema: public graph, public virtual Scope { - typedef - Cult::Containers::Vector - UsesList; - - typedef - Cult::Containers::Vector - UsedList; + typedef std::vector UsesList; + typedef std::vector UsedList; public: - Schema (Path const& file, UnsignedLong line, UnsignedLong column) - : SemanticGraph::Node (file, line, column) + Schema (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column), graph_ (*this) { } + private: + Schema (Schema const&); + Schema& operator= (Schema const&); + public: - typedef - Bits::PointerIterator - UsesIterator; + typedef pointer_iterator UsesIterator; UsesIterator uses_begin () const @@ -161,9 +127,8 @@ namespace XSDFrontend return uses_.end (); } - typedef - Bits::PointerIterator - UsedIterator; + public: + typedef pointer_iterator UsedIterator; UsedIterator used_begin () const @@ -177,7 +142,7 @@ namespace XSDFrontend return used_.end (); } - Boolean + bool used_p () const { return used_begin () != used_end (); @@ -187,90 +152,81 @@ namespace XSDFrontend find (Name const& name) const; public: - using Bits::Graph::new_edge; - using Bits::Graph::reset_left_node; - using Bits::Graph::reset_right_node; - using Bits::Graph::add_edge_left; - using Bits::Graph::add_edge_right; - using Bits::Graph::delete_node; - using Bits::Graph::delete_edge; + using graph::new_edge; + using graph::reset_left_node; + using graph::reset_right_node; + using graph::add_edge_left; + using graph::add_edge_right; + using graph::delete_node; + using graph::delete_edge; template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column) + new_node (Path const& file, unsigned long line, unsigned long column) { - return graph ().new_node (file, line, column); + return graph_.new_node (file, line, column); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0) { - return graph ().new_node (file, line, column, a0); + return graph_.new_node (file, line, column, a0); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0, A1 const& a1) { - return graph ().new_node (file, line, column, a0, a1); + return graph_.new_node (file, line, column, a0, a1); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0, A1 const& a1, A2 const& a2) { - return graph ().new_node (file, line, column, a0, a1, a2); + return graph_.new_node (file, line, column, a0, a1, a2); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3) { - return graph ().new_node (file, line, column, a0, a1, a2, a3); + return graph_.new_node (file, line, column, a0, a1, a2, a3); } - protected: - //@@ gcc bug #21146 - // - friend class Bits::Graph; - + public: using Scope::add_edge_left; using Node::add_edge_right; - Void + void add_edge_left (Uses& e) { uses_.push_back (&e); } - Void + void add_edge_right (Uses& e) { used_.push_back (&e); } private: - Bits::Graph& - graph () - { - return *this; - } + typedef std::set SchemaSet; - private: - UsesList uses_; - UsedList used_; + void + find_ (Name const& name, NamesList&, SchemaSet&) const; private: - typedef Cult::Containers::Set SchemaSet; + graph& graph_; - Void - find_ (Name const& name, NamesList&, SchemaSet&) const; + UsesList uses_; + UsedList used_; mutable NamesList names_; mutable SchemaSet schemas_; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx index b4b4cf0..4e7436d 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx @@ -1,37 +1,34 @@ // file : xsd-frontend/semantic-graph/union.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + Union:: + Union (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct UnionInit { UnionInit () { - TypeInfo ti (typeid (Union)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (Union)); + ti.add_base (typeid (Specialization)); + insert (ti); } - } union_init_; } - - Union:: - Union (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx index 62df730..d7ba385 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/union.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_UNION_HXX @@ -14,10 +13,8 @@ namespace XSDFrontend { class Union: public virtual Specialization { - protected: - friend class Bits::Graph; - - Union (Path const& file, UnsignedLong line, UnsignedLong column); + public: + Union (Path const& file, unsigned long line, unsigned long column); }; } } diff --git a/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx b/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx index 118fd5d..1c42d98 100644 --- a/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx +++ b/libxsd-frontend/xsd-frontend/transformations/anonymous.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/transformations/anonymous.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -10,27 +9,281 @@ #include #include +#include using std::wcerr; using std::endl; namespace XSDFrontend { - using namespace Cult; - - typedef WideString String; - namespace { using Transformations::AnonymousNameTranslator; + // + // + struct CompareMembers: Traversal::Element, + Traversal::Attribute, + Traversal::Any, + Traversal::AnyAttribute + { + CompareMembers (SemanticGraph::Nameable& m, bool& r) + : member_ (m), result_ (r) + { + } + + virtual void + traverse (SemanticGraph::Element& x) + { + using SemanticGraph::Element; + + Element& y (dynamic_cast (member_)); + + // Check cardinalities. + // + if (x.min () != y.min () || x.max () != y.max ()) + return; + + traverse_member (x); + } + + virtual void + traverse (SemanticGraph::Attribute& x) + { + using SemanticGraph::Attribute; + + Attribute& y (dynamic_cast (member_)); + + // Check cardinalities. + // + if (x.optional_p () != y.optional_p ()) + return; + + traverse_member (x); + } + + virtual void + traverse_member (SemanticGraph::Member& x) + { + using SemanticGraph::Member; + + Member& y (dynamic_cast (member_)); + + // Check name. + // + if (x.name () != y.name ()) + return; + + // Check namespace. + // + if (x.qualified_p () || y.qualified_p ()) + { + if (!x.qualified_p () || !y.qualified_p ()) + return; + + if (x.namespace_ ().name () != y.namespace_ ().name ()) + return; + } + + // Check type. + // + // @@ What if types are anonymous and structurally equal? + // + if (&x.type () != &y.type ()) + return; + + // Check default/fixed values. + // + if (x.default_p () != y.default_p () || x.fixed_p () != y.fixed_p ()) + return; + + if (x.default_p () && x.value () != y.value ()) + return; + + result_ = true; + } + + virtual void + traverse (SemanticGraph::Any&) + { + //@@ TODO + } + + virtual void + traverse (SemanticGraph::AnyAttribute&) + { + //@@ TODO + } + + private: + SemanticGraph::Nameable& member_; + bool& result_; + }; + + // Compare two types for structural equality. + // + struct CompareTypes: Traversal::List, + Traversal::Union, + Traversal::Enumeration, + Traversal::Complex + { + CompareTypes (SemanticGraph::Type& t, bool& r) + : type_ (t), result_ (r) + { + } + + + virtual void + traverse (SemanticGraph::List&) + { + using SemanticGraph::List; + + //List& y (dynamic_cast (type_)); + } + + virtual void + traverse (SemanticGraph::Union& x) + { + using SemanticGraph::Union; + + Union& y (dynamic_cast (type_)); + + Union::ArgumentedIterator ix (x.argumented_begin ()), + iy (y.argumented_begin ()); + + for (; ix != x.argumented_end () && iy != y.argumented_end (); + ++ix, ++iy) + { + // @@ Anon structurally equivalent. + // + if (&iy->type () != &ix->type ()) + return; + } + + result_ = true; + } + + virtual void + traverse (SemanticGraph::Enumeration& x) + { + using SemanticGraph::Enumeration; + + Enumeration& y (dynamic_cast (type_)); + + // Bases should be the same. + // + if (&x.inherits ().base () != &y.inherits ().base ()) + return; + + // Make sure facets match. + // + using SemanticGraph::Restricts; + + Restricts& rx (dynamic_cast (x.inherits ())); + Restricts& ry (dynamic_cast (y.inherits ())); + + if (rx.facets () != ry.facets ()) + return; + + // Compare enumerators. + // + using SemanticGraph::Scope; + + Scope::NamesIterator ix (x.names_begin ()), iy (y.names_begin ()); + for (; ix != x.names_end () && iy != y.names_end (); ++ix, ++iy) + { + if (ix->name () != iy->name ()) + return; + } + + if (ix != x.names_end () || iy != y.names_end ()) + return; + + result_ = true; + } + + virtual void + traverse (SemanticGraph::Complex& x) + { + using SemanticGraph::Complex; + + Complex& y (dynamic_cast (type_)); + + // Check inheritance. + // + if (x.inherits_p () || y.inherits_p ()) + { + // They both must inherits. + // + if (!x.inherits_p () || !y.inherits_p ()) + return; + + // With the same kind of inheritance (restriction or extension). + // + if (typeid (x.inherits ()) != typeid (y.inherits ())) + return; + + // Bases should be the same. + // + // @@ What if bases are anonymous? + // + if (&x.inherits ().base () != &y.inherits ().base ()) + return; + + // If it is a restriction, make sure facets match. + // + using SemanticGraph::Restricts; + + if (x.inherits ().is_a ()) + { + Restricts& rx (dynamic_cast (x.inherits ())); + Restricts& ry (dynamic_cast (y.inherits ())); + + if (rx.facets () != ry.facets ()) + return; + } + } + + // Check the member list. + // + // @@ Ignoring compositors at the moment. + // + using SemanticGraph::Scope; + + Scope::NamesIterator ix (x.names_begin ()), iy (y.names_begin ()); + for (; ix != x.names_end () && iy != y.names_end (); ++ix, ++iy) + { + if (typeid (ix->named ()) != typeid (iy->named ())) + return; + + bool equal (false); + CompareMembers t (iy->named (), equal); + t.dispatch (ix->named ()); + + if (!equal) + return; + } + + if (ix != x.names_end () || iy != y.names_end ()) + return; + + result_ = true; + } + + private: + SemanticGraph::Type& type_; + bool& result_; + }; + + // + // class Context { public: Context (SemanticGraph::Schema& schema_, SemanticGraph::Path const& file, AnonymousNameTranslator& trans_, - Boolean du) + bool du) : schema_path_ (file), ns_ (0), failed_ (false), @@ -56,6 +309,19 @@ namespace XSDFrontend } public: + + bool + structurally_equal (SemanticGraph::Type& x, SemanticGraph::Type& y) + { + if (typeid (x) != typeid (y)) + return false; + + bool r (false); + CompareTypes t (y, r); + t.dispatch (x); + return r; + } + struct UnstableConflict { UnstableConflict (SemanticGraph::Type& type) @@ -73,7 +339,7 @@ namespace XSDFrontend SemanticGraph::Type& type_; }; - Boolean + SemanticGraph::Type* conflict (String const& name) { using SemanticGraph::Type; @@ -96,10 +362,10 @@ namespace XSDFrontend throw UnstableConflict (*t1); } - return true; + return t1; } - return false; + return 0; } SemanticGraph::Type* @@ -179,17 +445,17 @@ namespace XSDFrontend private: SemanticGraph::Path const schema_path_; SemanticGraph::Namespace* ns_; - Boolean failed_; + bool failed_; public: AnonymousNameTranslator& trans; - Boolean detect_unstable; + bool detect_unstable; public: SemanticGraph::Schema& schema; SemanticGraph::Path const& schema_path; SemanticGraph::Namespace*& ns; - Boolean& failed; + bool& failed; }; @@ -198,7 +464,7 @@ namespace XSDFrontend // struct Uses: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Schema& s (u.schema ()); @@ -220,13 +486,13 @@ namespace XSDFrontend { } - Void + void pre (SemanticGraph::Namespace& ns) { ns_ = &ns; } - Void + void post (SemanticGraph::Namespace&) { ns_ = 0; @@ -248,7 +514,7 @@ namespace XSDFrontend { } - virtual Void + virtual void traverse (SemanticGraph::List& l) { SemanticGraph::Type& t (l.argumented ().type ()); @@ -264,6 +530,7 @@ namespace XSDFrontend // Run the name through the translation service. // SemanticGraph::Path file (path (l)); + file.normalize (); String file_str; // Try to use the portable representation of the path. If that @@ -271,15 +538,11 @@ namespace XSDFrontend // try { - file_str = file.string (); + file_str = file.posix_string (); } catch (SemanticGraph::InvalidPath const&) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - file_str = file.native_file_string (); -#else file_str = file.string (); -#endif } String name ( @@ -288,7 +551,7 @@ namespace XSDFrontend // Make sure the name is unique. // - UnsignedLong n (1); + unsigned long n (1); String escaped (name); while (conflict (escaped)) @@ -330,7 +593,7 @@ namespace XSDFrontend } } - virtual Void + virtual void traverse (SemanticGraph::Union& u) { String file_str; @@ -352,21 +615,18 @@ namespace XSDFrontend if (!file_str) { SemanticGraph::Path file (path (u)); + file.normalize (); // Try to use the portable representation of the path. If // that fails, fall back to the native representation. // try { - file_str = file.string (); + file_str = file.posix_string (); } catch (SemanticGraph::InvalidPath const&) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - file_str = file.native_file_string (); -#else file_str = file.string (); -#endif } } @@ -376,7 +636,7 @@ namespace XSDFrontend // Make sure the name is unique. // - UnsignedLong n (1); + unsigned long n (1); String escaped (name); while (conflict (escaped)) @@ -419,7 +679,7 @@ namespace XSDFrontend } } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (!c.inherits_p ()) @@ -438,6 +698,7 @@ namespace XSDFrontend // Run the name through the translation service. // SemanticGraph::Path file (path (c)); + file.normalize (); String file_str; // Try to use the portable representation of the path. If that @@ -445,15 +706,11 @@ namespace XSDFrontend // try { - file_str = file.string (); + file_str = file.posix_string (); } catch (SemanticGraph::InvalidPath const&) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - file_str = file.native_file_string (); -#else file_str = file.string (); -#endif } String name ( @@ -462,7 +719,7 @@ namespace XSDFrontend // Make sure the name is unique. // - UnsignedLong n (1); + unsigned long n (1); String escaped (name); while (conflict (escaped)) @@ -517,7 +774,7 @@ namespace XSDFrontend { } - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Type& t (e.type ()); @@ -560,7 +817,7 @@ namespace XSDFrontend } } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { SemanticGraph::Type& t (a.type ()); @@ -603,7 +860,7 @@ namespace XSDFrontend } } - Void + void traverse_ (SemanticGraph::Member& m) { using SemanticGraph::Type; @@ -640,6 +897,7 @@ namespace XSDFrontend // Run the name through the translation service. // SemanticGraph::Path file (path (m)); + file.normalize (); String file_str; // Try to use the portable representation of the path. If that @@ -647,27 +905,46 @@ namespace XSDFrontend // try { - file_str = file.string (); + file_str = file.posix_string (); } catch (SemanticGraph::InvalidPath const&) { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - file_str = file.native_file_string (); -#else file_str = file.string (); -#endif } String name ( trans.translate (file_str, ns->name (), m.name (), xpath (m))); - // Make sure the name is unique. + // Check if this name conflicts. // - UnsignedLong n (1); + unsigned long n (1); String escaped (name); - while (conflict (escaped)) + while (SemanticGraph::Type* other = conflict (escaped)) { + // First see if we should just use the other type. It should + // also have been anonymous and structurally equal to our type. + // + if (other->context ().count ("anonymous")) + { + if (structurally_equal (t, *other)) + { + // Reset the elements that are classified by this type to point + // to the other type. + // + for (Type::ClassifiesIterator i (t.classifies_begin ()); + i != t.classifies_end (); ++i) + { + schema.reset_right_node (*i, *other); + } + + //wcerr << "equal " << name << endl; + return; + } + //else + //wcerr << "unequal " << name << endl; + } + std::wostringstream os; os << n++; escaped = name + os.str (); @@ -687,10 +964,10 @@ namespace XSDFrontend { } - Void Anonymous:: + void Anonymous:: transform (SemanticGraph::Schema& s, SemanticGraph::Path const& f, - Boolean duc) + bool duc) { Context ctx (s, f, trans_, duc); diff --git a/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx b/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx index 2409822..cafd187 100644 --- a/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx +++ b/libxsd-frontend/xsd-frontend/transformations/anonymous.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/transformations/anonymous.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRANSFORMATIONS_ANONYMOUS_HXX #define XSD_FRONTEND_TRANSFORMATIONS_ANONYMOUS_HXX -#include +#include #include // Path #include @@ -15,8 +14,6 @@ namespace XSDFrontend { namespace Transformations { - using namespace Cult::Types; - class AnonymousNameTranslator { public: @@ -26,11 +23,11 @@ namespace XSDFrontend // The file argument is empty for the currect translation // unit. // - virtual WideString - translate (WideString const& file, - WideString const& ns, - WideString const& name, - WideString const& xpath) = 0; + virtual String + translate (String const& file, + String const& ns, + String const& name, + String const& xpath) = 0; }; // This transformation morphs anonymous types into named ones @@ -46,10 +43,10 @@ namespace XSDFrontend Anonymous (AnonymousNameTranslator&); - Void + void transform (SemanticGraph::Schema&, SemanticGraph::Path const&, - Boolean detect_unstable_conflicts); + bool detect_unstable_conflicts); private: AnonymousNameTranslator& trans_; diff --git a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx index e10b9d3..26ad16c 100644 --- a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx +++ b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx @@ -1,23 +1,19 @@ // file : xsd-frontend/transformations/enum-synthesis.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include +#include #include #include -#include +#include namespace XSDFrontend { - using namespace Cult; - typedef WideString String; - namespace { - typedef Cult::Containers::Set Enumerators; + typedef std::set Enumerators; struct Enumerator: Traversal::Enumerator { @@ -28,7 +24,7 @@ namespace XSDFrontend { } - virtual Void + virtual void traverse (Type& e) { String const& name (e.name ()); @@ -64,7 +60,7 @@ namespace XSDFrontend { } - virtual Void + virtual void traverse (Type& u) { using SemanticGraph::Enumeration; @@ -208,7 +204,7 @@ namespace XSDFrontend // struct Uses: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Schema& s (u.schema ()); @@ -224,7 +220,7 @@ namespace XSDFrontend namespace Transformations { - Void EnumSynthesis:: + void EnumSynthesis:: transform (SemanticGraph::Schema& s, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx index e3c38c7..9f0f970 100644 --- a/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx +++ b/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/transformations/enum-synthesis.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRANSFORMATIONS_ENUM_SYNTHESIS_HXX #define XSD_FRONTEND_TRANSFORMATIONS_ENUM_SYNTHESIS_HXX -#include +#include #include // Path #include @@ -15,8 +14,6 @@ namespace XSDFrontend { namespace Transformations { - using namespace Cult::Types; - // This transformation replaces unions of one or more enumerations // with the same base with an equivalent synthesized enumeration. // This transformation assumes that there are no anonymous types. @@ -24,7 +21,7 @@ namespace XSDFrontend class EnumSynthesis { public: - Void + void transform (SemanticGraph::Schema&, SemanticGraph::Path const&); }; } diff --git a/libxsd-frontend/xsd-frontend/transformations/restriction.cxx b/libxsd-frontend/xsd-frontend/transformations/restriction.cxx index c58d98f..edd74be 100644 --- a/libxsd-frontend/xsd-frontend/transformations/restriction.cxx +++ b/libxsd-frontend/xsd-frontend/transformations/restriction.cxx @@ -1,27 +1,21 @@ // file : xsd-frontend/transformations/restriction.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include +#include +#include #include #include -#include - -#include +#include -using std::wcerr; -using std::endl; +using namespace std; namespace XSDFrontend { - using namespace Cult; - - typedef WideString String; typedef Transformations::Restriction::Failed Failed; - typedef Containers::Vector BaseList; + typedef std::vector BaseList; namespace { @@ -34,7 +28,7 @@ namespace XSDFrontend { } - virtual Void + virtual void traverse (Type& c) { using namespace SemanticGraph; @@ -107,7 +101,7 @@ namespace XSDFrontend else { Compositor::ContainsIterator i (root.contains_begin ()); - BaseList::ReverseIterator j (base_model.rbegin ()); + BaseList::reverse_iterator j (base_model.rbegin ()); for (; i != root.contains_end (); ++i, ++j) { @@ -153,7 +147,7 @@ namespace XSDFrontend } private: - Void + void handle (SemanticGraph::Particle& r, SemanticGraph::Particle& b) { using namespace SemanticGraph; @@ -215,7 +209,7 @@ namespace XSDFrontend } } - Boolean + bool match (SemanticGraph::Particle& r, SemanticGraph::Particle& b) { using namespace SemanticGraph; @@ -282,7 +276,7 @@ namespace XSDFrontend return false; } - Void + void merge_attributes (SemanticGraph::Complex& c, SemanticGraph::Complex& base) { @@ -364,12 +358,12 @@ namespace XSDFrontend } } - Void + void handle_any_attributes (SemanticGraph::Complex& c, BaseList& bl) { using namespace SemanticGraph; - BaseList::ReverseIterator bi (bl.rbegin ()), be (bl.rend ()); + BaseList::reverse_iterator bi (bl.rbegin ()), be (bl.rend ()); Scope::NamesIterator si; if (bi != be) @@ -432,14 +426,14 @@ namespace XSDFrontend struct Anonymous : Traversal::Element, Traversal::Attribute { - Anonymous (Traversal::NodeDispatcherBase& d1) + Anonymous (Traversal::NodeDispatcher& d1) : complex_ (&d1, 0) { *this >> belongs_ >> complex_; } - Anonymous (Traversal::NodeDispatcherBase& d1, - Traversal::NodeDispatcherBase& d2) + Anonymous (Traversal::NodeDispatcher& d1, + Traversal::NodeDispatcher& d2) : complex_ (&d1, &d2) { *this >> belongs_ >> complex_; @@ -460,7 +454,7 @@ namespace XSDFrontend public: - virtual Void + virtual void traverse (SemanticGraph::Element& e) { SemanticGraph::Type& t (e.type ()); @@ -479,7 +473,7 @@ namespace XSDFrontend } } - virtual Void + virtual void traverse (SemanticGraph::Attribute& a) { SemanticGraph::Type& t (a.type ()); @@ -501,13 +495,13 @@ namespace XSDFrontend private: struct Complex : Traversal::Complex { - Complex (Traversal::NodeDispatcherBase* d1, - Traversal::NodeDispatcherBase* d2) + Complex (Traversal::NodeDispatcher* d1, + Traversal::NodeDispatcher* d2) : d1_ (d1), d2_ (d2) { } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (d1_) @@ -518,8 +512,8 @@ namespace XSDFrontend } private: - Traversal::NodeDispatcherBase* d1_; - Traversal::NodeDispatcherBase* d2_; + Traversal::NodeDispatcher* d1_; + Traversal::NodeDispatcher* d2_; } complex_; @@ -532,7 +526,7 @@ namespace XSDFrontend // struct Uses: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Schema& s (u.schema ()); @@ -548,7 +542,7 @@ namespace XSDFrontend namespace Transformations { - Void Restriction:: + void Restriction:: transform (SemanticGraph::Schema& s, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/libxsd-frontend/xsd-frontend/transformations/restriction.hxx b/libxsd-frontend/xsd-frontend/transformations/restriction.hxx index 7c3282e..6d7410c 100644 --- a/libxsd-frontend/xsd-frontend/transformations/restriction.hxx +++ b/libxsd-frontend/xsd-frontend/transformations/restriction.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/transformations/restriction.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRANSFORMATIONS_RESTRICTION_HXX #define XSD_FRONTEND_TRANSFORMATIONS_RESTRICTION_HXX -#include +#include #include // Path #include @@ -15,8 +14,6 @@ namespace XSDFrontend { namespace Transformations { - using namespace Cult::Types; - // This transformation performs two major tasks. It transfers omitted // attribute declarations from the base to derived-by-restriction type // and establishes correspondence between particles and compositors by @@ -30,7 +27,7 @@ namespace XSDFrontend public: struct Failed {}; - Void + void transform (SemanticGraph::Schema&, SemanticGraph::Path const&); }; } diff --git a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx index 9ac8445..2fc14b5 100644 --- a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx +++ b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.cxx @@ -1,48 +1,42 @@ // file : xsd-frontend/transformations/schema-per-type.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include - -#include -#include +#include // strcasecmp -#include -#include -#include +#include +#include +#include #include #include -#include // strcasecmp +#include +#include + +#include using std::wcerr; using std::endl; namespace XSDFrontend { - using namespace Cult; - - typedef WideString String; typedef Transformations::SchemaPerType::Failed Failed; - - typedef Containers::Vector Schemas; - typedef Containers::Map TypeSchemaMap; + typedef std::vector Schemas; + typedef std::map TypeSchemaMap; // Compare file paths case-insensitively. // struct FileComparator { - Boolean + bool operator() (NarrowString const& x, NarrowString const& y) const { return strcasecmp (x.c_str (), y.c_str ()) < 0; } }; - typedef Containers::Set FileSet; + typedef std::set FileSet; namespace { @@ -59,7 +53,7 @@ namespace XSDFrontend xsd_ = 0; } - virtual Void + virtual void traverse (SemanticGraph::Includes& i) { SemanticGraph::Schema& s (i.schema ()); @@ -72,7 +66,7 @@ namespace XSDFrontend } } - virtual Void + virtual void traverse (SemanticGraph::Imports& i) { SemanticGraph::Schema& s (i.schema ()); @@ -85,7 +79,7 @@ namespace XSDFrontend } } - virtual Void + virtual void traverse (SemanticGraph::Implies& i) { if (xsd_ == 0) @@ -97,12 +91,13 @@ namespace XSDFrontend SemanticGraph::Schema*& xsd_; }; - Void + void process_schema (SemanticGraph::Schema& s, SemanticGraph::Schema& root, SemanticGraph::Schema& xsd, TypeSchemaMap& tsm, FileSet& file_set, + bool fat_type_file, Transformations::SchemaPerTypeTranslator& trans) { using namespace SemanticGraph; @@ -141,7 +136,7 @@ namespace XSDFrontend // if (!tn) { - for (NarrowString::Iterator i (base.begin ()), e (base.end ()); + for (NarrowString::iterator i (base.begin ()), e (base.end ()); i != e; ++i) { if (*i == '/' || *i == '\\') @@ -153,7 +148,7 @@ namespace XSDFrontend // NarrowString file_name (base); - for (UnsignedLong i (1); + for (unsigned long i (1); file_set.find (file_name) != file_set.end (); ++i) { @@ -167,11 +162,7 @@ namespace XSDFrontend try { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 path = Path (file_name); -#else - path = Path (file_name.c_str()); -#endif } catch (InvalidPath const&) { @@ -184,7 +175,7 @@ namespace XSDFrontend throw Failed (); } } - catch (String::NonRepresentable const&) + catch (NonRepresentable const&) { wcerr << "error: '" << wbase << "' cannot be represented as a " << "narrow string" << endl; @@ -195,6 +186,8 @@ namespace XSDFrontend throw Failed (); } + Type& t (dynamic_cast (n)); + Schema& ts (root.new_node (path, 1, 1)); root.new_edge (ts, xsd, xsd_path); @@ -202,11 +195,43 @@ namespace XSDFrontend root.new_edge (ts, tns, ns.name ()); root.new_edge (tns, n, name); + // If we are generating fat type files, then also move the global + // elements this type classifies to the new schema. + // + if (fat_type_file) + { + for (Type::ClassifiesIterator j (t.classifies_begin ()); + j != t.classifies_end (); ++j) + { + Instance& e (j->instance ()); + + // We can only move a global element from the same namespace. + // + if (e.is_a () && + e.scope ().is_a () && + e.scope ().name () == ns.name ()) + { + Names& n (e.named ()); + String name (n.name ()); + + // Watch out for the iterator validity: the edge we are + // about to remove can be from the same list we are + // currently iterating. + // + if (i != ns.names_end () && &*i == &n) + ++i; + + root.delete_edge (n.scope (), e, n); + root.new_edge (tns, e, name); + } + } + } + // Add include to the original schema and enter into the // type-schema map. // root.new_edge (s, ts, path); - tsm[&dynamic_cast (n)] = &ts; + tsm[&t] = &ts; } else ++i; @@ -219,7 +244,7 @@ namespace XSDFrontend { Type (SemanticGraph::Schema& schema, SemanticGraph::Schema& root, - Char const* by_value_key, + char const* by_value_key, TypeSchemaMap& tsm) : schema_ (schema), root_ (root), @@ -229,7 +254,7 @@ namespace XSDFrontend *this >> names_ >> *this; } - virtual Void + virtual void traverse (SemanticGraph::List& l) { // Treat item type as base type since it is impossible @@ -239,7 +264,7 @@ namespace XSDFrontend set_dep (t, false); } - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (c.inherits_p ()) @@ -248,26 +273,26 @@ namespace XSDFrontend Traversal::Complex::names (c); } - virtual Void + virtual void traverse (SemanticGraph::Member& m) { SemanticGraph::Type& t (m.type ()); - Boolean weak ( + bool weak ( by_value_key_ == 0 || !t.context ().count (by_value_key_) || - !t.context ().get (by_value_key_)); + !t.context ().get (by_value_key_)); set_dep (t, weak); } private: - Void - set_dep (SemanticGraph::Type& t, Boolean weak) + void + set_dep (SemanticGraph::Type& t, bool weak) { using namespace SemanticGraph; - TypeSchemaMap::Iterator i (tsm_.find (&t)); + TypeSchemaMap::iterator i (tsm_.find (&t)); // If a type is not present in the map then it must be // a built-in type. @@ -301,9 +326,9 @@ namespace XSDFrontend private: SemanticGraph::Schema& schema_; SemanticGraph::Schema& root_; - Char const* by_value_key_; + char const* by_value_key_; TypeSchemaMap& tsm_; - Containers::Set type_set_; + std::set type_set_; Traversal::Names names_; }; @@ -312,8 +337,10 @@ namespace XSDFrontend namespace Transformations { SchemaPerType:: - SchemaPerType (SchemaPerTypeTranslator& trans, Char const* by_value_key) - : by_value_key_ (by_value_key), trans_ (trans) + SchemaPerType (SchemaPerTypeTranslator& trans, + bool fat, + char const* key) + : fat_type_file_ (fat), by_value_key_ (key), trans_ (trans) { } @@ -344,8 +371,10 @@ namespace XSDFrontend // FileSet file_set; - for (Schemas::Iterator i (schemas.begin ()); i != schemas.end (); ++i) + for (Schemas::iterator i (schemas.begin ()); i != schemas.end (); ++i) { + // This path was already normalized by the parser. + // SemanticGraph::Path const& path ( (*i)->context ().get ("absolute-path")); @@ -353,31 +382,22 @@ namespace XSDFrontend // NarrowString abs_path; -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 // Try to use the portable representation of the path. If that // fails, fall back to the native representation. // try { - abs_path = path.string (); + abs_path = path.posix_string (); } catch (SemanticGraph::InvalidPath const&) { - abs_path = path.native_file_string (); + abs_path = path.string (); } -#else - // The new ABI does not have a fallback native representation - abs_path = path.string (); -#endif NarrowString tf (trans_.translate_schema (abs_path)); -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 - NarrowString file (tf ? tf : path.leaf ()); -#else - NarrowString file (tf ? tf : path.filename ().string()); -#endif + NarrowString file (tf ? tf : path.leaf ().string ()); - Size p (file.rfind ('.')); + size_t p (file.rfind ('.')); NarrowString ext ( p != NarrowString::npos ? NarrowString (file, p) : ""); @@ -388,7 +408,7 @@ namespace XSDFrontend // NarrowString new_name (base); - for (UnsignedLong n (1); + for (unsigned long n (1); file_set.find (new_name) != file_set.end (); ++n) { @@ -402,11 +422,7 @@ namespace XSDFrontend try { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 (*i)->context ().set ("renamed", SemanticGraph::Path (new_name)); -#else - (*i)->context ().set ("renamed", SemanticGraph::Path (new_name.c_str())); -#endif } catch (SemanticGraph::InvalidPath const&) { @@ -424,9 +440,9 @@ namespace XSDFrontend // TypeSchemaMap tsm; - for (Schemas::Iterator i (schemas.begin ()); i != schemas.end (); ++i) + for (Schemas::iterator i (schemas.begin ()); i != schemas.end (); ++i) { - process_schema (**i, root, *xsd, tsm, file_set, trans_); + process_schema (**i, root, *xsd, tsm, file_set, fat_type_file_, trans_); } // wcerr << tsm.size () << " type schema nodes" << endl; @@ -434,7 +450,7 @@ namespace XSDFrontend // Establish include/import dependencies. While at it add the // new schemas to the list which we will return. // - for (TypeSchemaMap::Iterator i (tsm.begin ()); i != tsm.end (); ++i) + for (TypeSchemaMap::iterator i (tsm.begin ()); i != tsm.end (); ++i) { SemanticGraph::Schema& s (*i->second); Type t (s, root, by_value_key_, tsm); diff --git a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx index 89b6d83..8b6a69e 100644 --- a/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx +++ b/libxsd-frontend/xsd-frontend/transformations/schema-per-type.hxx @@ -1,13 +1,13 @@ // file : xsd-frontend/transformations/schema-per-type.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRANSFORMATIONS_SCHEMA_PER_TYPE_HXX #define XSD_FRONTEND_TRANSFORMATIONS_SCHEMA_PER_TYPE_HXX -#include -#include +#include + +#include #include // Path #include @@ -16,8 +16,6 @@ namespace XSDFrontend { namespace Transformations { - using namespace Cult::Types; - class SchemaPerTypeTranslator { public: @@ -27,8 +25,8 @@ namespace XSDFrontend // The following two functions should return empty string if // there is no match. // - virtual WideString - translate_type (WideString const& ns, WideString const& name) = 0; + virtual String + translate_type (String const& ns, String const& name) = 0; virtual NarrowString translate_schema (NarrowString const& abs_path) = 0; @@ -46,13 +44,16 @@ namespace XSDFrontend // with the by_value_key key and it is true, then the schema // for this type is included "strongly". // - SchemaPerType (SchemaPerTypeTranslator&, Char const* by_value_key = 0); + SchemaPerType (SchemaPerTypeTranslator&, + bool fat_type_file, + char const* by_value_key = 0); - Cult::Containers::Vector + std::vector transform (SemanticGraph::Schema&); private: - Char const* by_value_key_; + bool fat_type_file_; + char const* by_value_key_; SchemaPerTypeTranslator& trans_; }; } diff --git a/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx b/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx index 2ccaed2..9372a4a 100644 --- a/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx +++ b/libxsd-frontend/xsd-frontend/transformations/simplifier.cxx @@ -1,19 +1,14 @@ // file : xsd-frontend/transformations/simplifier.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file -#include - #include #include -#include +#include namespace XSDFrontend { - using namespace Cult; - namespace { struct Compositor: Traversal::All, @@ -25,7 +20,7 @@ namespace XSDFrontend { } - virtual Void + virtual void traverse (SemanticGraph::All& a) { // The all compositor cannot contain compositors. @@ -34,7 +29,7 @@ namespace XSDFrontend remove (a); } - virtual Void + virtual void traverse (SemanticGraph::Choice& c) { // Do the depth-first traversal so that we take into account @@ -54,7 +49,7 @@ namespace XSDFrontend remove (c); } - virtual Void + virtual void traverse (SemanticGraph::Sequence& s) { // Do the depth-first traversal so that we take into account @@ -73,7 +68,7 @@ namespace XSDFrontend } private: - virtual Void + virtual void remove (SemanticGraph::Compositor& c) { using SemanticGraph::Node; @@ -106,7 +101,7 @@ namespace XSDFrontend // struct Type: Traversal::Complex { - virtual Void + virtual void traverse (SemanticGraph::Complex& c) { if (c.contains_compositor_p ()) @@ -119,7 +114,7 @@ namespace XSDFrontend // struct Uses: Traversal::Uses { - virtual Void + virtual void traverse (Type& u) { SemanticGraph::Schema& s (u.schema ()); @@ -135,7 +130,7 @@ namespace XSDFrontend namespace Transformations { - Void Simplifier:: + void Simplifier:: transform (SemanticGraph::Schema& s, SemanticGraph::Path const&) { Traversal::Schema schema; diff --git a/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx b/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx index 676c166..674ee45 100644 --- a/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx +++ b/libxsd-frontend/xsd-frontend/transformations/simplifier.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/transformations/simplifier.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRANSFORMATIONS_SIMPLIFIER_HXX #define XSD_FRONTEND_TRANSFORMATIONS_SIMPLIFIER_HXX -#include +#include #include // Path #include @@ -15,8 +14,6 @@ namespace XSDFrontend { namespace Transformations { - using namespace Cult::Types; - // This transformation performs various schema simplifications // (e.g., removing empty compositors, etc). This transformation // assumes that there are no anonymous types. @@ -24,7 +21,7 @@ namespace XSDFrontend class Simplifier { public: - Void + void transform (SemanticGraph::Schema&, SemanticGraph::Path const&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal.hxx b/libxsd-frontend/xsd-frontend/traversal.hxx index 9b1c359..10190a1 100644 --- a/libxsd-frontend/xsd-frontend/traversal.hxx +++ b/libxsd-frontend/xsd-frontend/traversal.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx b/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx index 55ed999..50655dd 100644 --- a/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/any-attribute.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/any-attribute.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ANY_ATTRIBUTE_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/any.hxx b/libxsd-frontend/xsd-frontend/traversal/any.hxx index 505d336..85a320d 100644 --- a/libxsd-frontend/xsd-frontend/traversal/any.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/any.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/any.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ANY_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx b/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx index e5c2237..a40afd7 100644 --- a/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/attribute-group.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/attribute-group.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -9,7 +8,7 @@ namespace XSDFrontend { namespace Traversal { - Void AttributeGroup:: + void AttributeGroup:: traverse (Type& g) { pre (g); @@ -17,12 +16,12 @@ namespace XSDFrontend post (g); } - Void AttributeGroup:: + void AttributeGroup:: pre (Type&) { } - Void AttributeGroup:: + void AttributeGroup:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx b/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx index cd01a97..03fee14 100644 --- a/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/attribute-group.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/attribute-group.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_GROUP_HXX @@ -15,13 +14,13 @@ namespace XSDFrontend { struct AttributeGroup: ScopeTemplate { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute.cxx b/libxsd-frontend/xsd-frontend/traversal/attribute.cxx index c051667..e61eeb2 100644 --- a/libxsd-frontend/xsd-frontend/traversal/attribute.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/attribute.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/attribute.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -9,7 +8,7 @@ namespace XSDFrontend { namespace Traversal { - Void Attribute:: + void Attribute:: traverse (Type& a) { pre (a); @@ -18,29 +17,29 @@ namespace XSDFrontend post (a); } - Void Attribute:: + void Attribute:: pre (Type&) { } - Void Attribute:: - belongs (Type& a, EdgeDispatcherBase& d) + void Attribute:: + belongs (Type& a, EdgeDispatcher& d) { d.dispatch (a.belongs ()); } - Void Attribute:: + void Attribute:: belongs (Type& a) { belongs (a, *this); } - Void Attribute:: + void Attribute:: name (Type&) { } - Void Attribute:: + void Attribute:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/attribute.hxx b/libxsd-frontend/xsd-frontend/traversal/attribute.hxx index feb6b31..f3962e4 100644 --- a/libxsd-frontend/xsd-frontend/traversal/attribute.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/attribute.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/attribute.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ATTRIBUTE_HXX @@ -17,22 +16,22 @@ namespace XSDFrontend { struct Attribute : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void - belongs (Type&, EdgeDispatcherBase&); + virtual void + belongs (Type&, EdgeDispatcher&); - virtual Void + virtual void belongs (Type&); - virtual Void + virtual void name (Type&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/complex.cxx b/libxsd-frontend/xsd-frontend/traversal/complex.cxx index d6cfc41..6e936ab 100644 --- a/libxsd-frontend/xsd-frontend/traversal/complex.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/complex.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/complex.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -9,7 +8,7 @@ namespace XSDFrontend { namespace Traversal { - Void Complex:: + void Complex:: traverse (Type& c) { pre (c); @@ -20,43 +19,43 @@ namespace XSDFrontend post (c); } - Void Complex:: + void Complex:: pre (Type&) { } - Void Complex:: + void Complex:: name (Type&) { } - Void Complex:: + void Complex:: inherits (Type& c) { inherits (c, *this); } - Void Complex:: - inherits (Type& c, EdgeDispatcherBase& d) + void Complex:: + inherits (Type& c, EdgeDispatcher& d) { if (c.inherits_p ()) d.dispatch (c.inherits ()); } - Void Complex:: + void Complex:: contains_compositor (Type& c) { contains_compositor (c, *this); } - Void Complex:: - contains_compositor (Type& c, EdgeDispatcherBase& d) + void Complex:: + contains_compositor (Type& c, EdgeDispatcher& d) { if (c.contains_compositor_p ()) d.dispatch (c.contains_compositor ()); } - Void Complex:: + void Complex:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/complex.hxx b/libxsd-frontend/xsd-frontend/traversal/complex.hxx index 3dd7e7b..1f55730 100644 --- a/libxsd-frontend/xsd-frontend/traversal/complex.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/complex.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/complex.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_COMPLEX_HXX @@ -15,28 +14,28 @@ namespace XSDFrontend { struct Complex : ScopeTemplate { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void name (Type&); - virtual Void + virtual void inherits (Type&); - Void - inherits (Type&, EdgeDispatcherBase&); + void + inherits (Type&, EdgeDispatcher&); - virtual Void + virtual void contains_compositor (Type&); - Void - contains_compositor (Type&, EdgeDispatcherBase&); + void + contains_compositor (Type&, EdgeDispatcher&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/compositors.cxx b/libxsd-frontend/xsd-frontend/traversal/compositors.cxx index d3089fc..f2b3dcd 100644 --- a/libxsd-frontend/xsd-frontend/traversal/compositors.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/compositors.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/compositors.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -11,7 +10,7 @@ namespace XSDFrontend { // ContainsParticle // - Void ContainsParticle:: + void ContainsParticle:: traverse (Type& c) { dispatch (c.particle ()); @@ -20,7 +19,7 @@ namespace XSDFrontend // ContainsCompositor // - Void ContainsCompositor:: + void ContainsCompositor:: traverse (Type& c) { dispatch (c.compositor ()); @@ -29,7 +28,7 @@ namespace XSDFrontend // Compositor // - Void Compositor:: + void Compositor:: traverse (Type& c) { pre (c); @@ -37,25 +36,25 @@ namespace XSDFrontend post (c); } - Void Compositor:: + void Compositor:: pre (Type&) { } - Void Compositor:: + void Compositor:: contains (Type& c) { iterate_and_dispatch ( c.contains_begin (), c.contains_end (), edge_traverser ()); } - Void Compositor:: - contains (Type& c, EdgeDispatcherBase& d) + void Compositor:: + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } - Void Compositor:: + void Compositor:: post (Type&) { } @@ -63,7 +62,7 @@ namespace XSDFrontend // All // - Void All:: + void All:: traverse (Type& c) { pre (c); @@ -71,25 +70,25 @@ namespace XSDFrontend post (c); } - Void All:: + void All:: pre (Type&) { } - Void All:: + void All:: contains (Type& c) { iterate_and_dispatch ( c.contains_begin (), c.contains_end (), edge_traverser ()); } - Void All:: - contains (Type& c, EdgeDispatcherBase& d) + void All:: + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } - Void All:: + void All:: post (Type&) { } @@ -97,7 +96,7 @@ namespace XSDFrontend // Choice // - Void Choice:: + void Choice:: traverse (Type& c) { pre (c); @@ -105,25 +104,25 @@ namespace XSDFrontend post (c); } - Void Choice:: + void Choice:: pre (Type&) { } - Void Choice:: + void Choice:: contains (Type& c) { iterate_and_dispatch ( c.contains_begin (), c.contains_end (), edge_traverser ()); } - Void Choice:: - contains (Type& c, EdgeDispatcherBase& d) + void Choice:: + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } - Void Choice:: + void Choice:: post (Type&) { } @@ -131,7 +130,7 @@ namespace XSDFrontend // Sequence // - Void Sequence:: + void Sequence:: traverse (Type& c) { pre (c); @@ -139,25 +138,25 @@ namespace XSDFrontend post (c); } - Void Sequence:: + void Sequence:: pre (Type&) { } - Void Sequence:: + void Sequence:: contains (Type& c) { iterate_and_dispatch ( c.contains_begin (), c.contains_end (), edge_traverser ()); } - Void Sequence:: - contains (Type& c, EdgeDispatcherBase& d) + void Sequence:: + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } - Void Sequence:: + void Sequence:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/compositors.hxx b/libxsd-frontend/xsd-frontend/traversal/compositors.hxx index e81460b..4761b99 100644 --- a/libxsd-frontend/xsd-frontend/traversal/compositors.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/compositors.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/compositors.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_COMPOSITORS_HXX @@ -26,7 +25,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type&); }; @@ -44,7 +43,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type&); }; @@ -52,19 +51,19 @@ namespace XSDFrontend // struct Compositor : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void contains (Type&); - virtual Void - contains (Type&, EdgeDispatcherBase&); + virtual void + contains (Type&, EdgeDispatcher&); - virtual Void + virtual void post (Type&); }; @@ -73,19 +72,19 @@ namespace XSDFrontend // struct All : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void contains (Type&); - virtual Void - contains (Type&, EdgeDispatcherBase&); + virtual void + contains (Type&, EdgeDispatcher&); - virtual Void + virtual void post (Type&); }; @@ -94,19 +93,19 @@ namespace XSDFrontend // struct Choice : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void contains (Type&); - virtual Void - contains (Type&, EdgeDispatcherBase&); + virtual void + contains (Type&, EdgeDispatcher&); - virtual Void + virtual void post (Type&); }; @@ -115,19 +114,19 @@ namespace XSDFrontend // struct Sequence : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void contains (Type&); - virtual Void - contains (Type&, EdgeDispatcherBase&); + virtual void + contains (Type&, EdgeDispatcher&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/element-group.cxx b/libxsd-frontend/xsd-frontend/traversal/element-group.cxx index cb7a51a..0b253dd 100644 --- a/libxsd-frontend/xsd-frontend/traversal/element-group.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/element-group.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/element-group.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -9,7 +8,7 @@ namespace XSDFrontend { namespace Traversal { - Void ElementGroup:: + void ElementGroup:: traverse (Type& g) { pre (g); @@ -18,24 +17,24 @@ namespace XSDFrontend post (g); } - Void ElementGroup:: + void ElementGroup:: pre (Type&) { } - Void ElementGroup:: - contains_compositor (Type& g, EdgeDispatcherBase& d) + void ElementGroup:: + contains_compositor (Type& g, EdgeDispatcher& d) { d.dispatch (g.contains_compositor ()); } - Void ElementGroup:: + void ElementGroup:: contains_compositor (Type& g) { contains_compositor (g, *this); } - Void ElementGroup:: + void ElementGroup:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/element-group.hxx b/libxsd-frontend/xsd-frontend/traversal/element-group.hxx index 8ebe0bd..df13b26 100644 --- a/libxsd-frontend/xsd-frontend/traversal/element-group.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/element-group.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/element-group.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ELEMENT_GROUP_HXX @@ -15,19 +14,19 @@ namespace XSDFrontend { struct ElementGroup: ScopeTemplate { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void contains_compositor (Type&); - virtual Void - contains_compositor (Type&, EdgeDispatcherBase&); + virtual void + contains_compositor (Type&, EdgeDispatcher&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/element.cxx b/libxsd-frontend/xsd-frontend/traversal/element.cxx index 7f296ee..efdb0a6 100644 --- a/libxsd-frontend/xsd-frontend/traversal/element.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/element.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/element.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -9,7 +8,7 @@ namespace XSDFrontend { namespace Traversal { - Void Element:: + void Element:: traverse (Type& m) { pre (m); @@ -18,29 +17,29 @@ namespace XSDFrontend post (m); } - Void Element:: + void Element:: pre (Type&) { } - Void Element:: - belongs (Type& m, EdgeDispatcherBase& d) + void Element:: + belongs (Type& m, EdgeDispatcher& d) { d.dispatch (m.belongs ()); } - Void Element:: + void Element:: belongs (Type& m) { belongs (m, edge_traverser ()); } - Void Element:: + void Element:: name (Type&) { } - Void Element:: + void Element:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/element.hxx b/libxsd-frontend/xsd-frontend/traversal/element.hxx index d5187ad..e1af29a 100644 --- a/libxsd-frontend/xsd-frontend/traversal/element.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/element.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/element.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ELEMENT_HXX @@ -15,22 +14,22 @@ namespace XSDFrontend { struct Element : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void - belongs (Type&, EdgeDispatcherBase&); + virtual void + belongs (Type&, EdgeDispatcher&); - virtual Void + virtual void belongs (Type&); - virtual Void + virtual void name (Type&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.cxx b/libxsd-frontend/xsd-frontend/traversal/elements.cxx index b1c47a0..e64e3b9 100644 --- a/libxsd-frontend/xsd-frontend/traversal/elements.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/elements.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/elements.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -11,7 +10,7 @@ namespace XSDFrontend { // Instance // - Void Instance:: + void Instance:: traverse (Type& a) { pre (a); @@ -19,24 +18,24 @@ namespace XSDFrontend post (a); } - Void Instance:: + void Instance:: pre (Type&) { } - Void Instance:: - belongs (Type& a, EdgeDispatcherBase& d) + void Instance:: + belongs (Type& a, EdgeDispatcher& d) { d.dispatch (a.belongs ()); } - Void Instance:: + void Instance:: belongs (Type& a) { belongs (a, edge_traverser ()); } - Void Instance:: + void Instance:: post (Type&) { } @@ -44,7 +43,7 @@ namespace XSDFrontend // Member // - Void Member:: + void Member:: traverse (Type& a) { pre (a); @@ -52,24 +51,24 @@ namespace XSDFrontend post (a); } - Void Member:: + void Member:: pre (Type&) { } - Void Member:: - belongs (Type& a, EdgeDispatcherBase& d) + void Member:: + belongs (Type& a, EdgeDispatcher& d) { d.dispatch (a.belongs ()); } - Void Member:: + void Member:: belongs (Type& a) { belongs (a, edge_traverser ()); } - Void Member:: + void Member:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.hxx b/libxsd-frontend/xsd-frontend/traversal/elements.hxx index c405a1b..bd1dd70 100644 --- a/libxsd-frontend/xsd-frontend/traversal/elements.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/elements.hxx @@ -1,165 +1,97 @@ // file : xsd-frontend/traversal/elements.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ELEMENTS_HXX #define XSD_FRONTEND_TRAVERSAL_ELEMENTS_HXX -#include - -#include +#include +#include #include namespace XSDFrontend { namespace Traversal { - using namespace Cult::Types; - - namespace Bits - { - using FrontendElements::Traversal::TraverserBase; - using FrontendElements::Traversal::Traverser; - - using FrontendElements::Traversal::DispatcherBase; - using FrontendElements::Traversal::Dispatcher; - - } - - typedef Bits::DispatcherBase NodeDispatcherBase; - typedef Bits::DispatcherBase EdgeDispatcherBase; + using namespace cutl; + typedef compiler::dispatcher NodeDispatcher; + typedef compiler::dispatcher EdgeDispatcher; // // - struct NodeBase : virtual Bits::Dispatcher, - virtual Bits::Dispatcher + struct NodeBase: NodeDispatcher, EdgeDispatcher { - Void - edge_traverser (EdgeDispatcherBase& d) + void + edge_traverser (EdgeDispatcher& d) { - Bits::Dispatcher::traverser (d); + EdgeDispatcher::traverser (d); } - EdgeDispatcherBase& + EdgeDispatcher& edge_traverser () { return *this; } - public: - using Bits::Dispatcher::dispatch; - using Bits::Dispatcher::dispatch; - - using Bits::Dispatcher::map; - - using Bits::Dispatcher::iterate_and_dispatch; - }; - - - // - // - template - struct Node : Bits::TraverserBase, virtual NodeBase - { - typedef - T - Type; - - Node () - { - map (typeid (Type), *this); - } - - virtual Void - traverse (Type&) = 0; + using NodeDispatcher::dispatch; + using EdgeDispatcher::dispatch; - virtual Void - trampoline (SemanticGraph::Node& i) - { - traverse (dynamic_cast (i)); - } - - virtual Void - trampoline (SemanticGraph::Node const&) - { - abort (); - } + using EdgeDispatcher::iterate_and_dispatch; }; - - // - // - struct EdgeBase : virtual Bits::Dispatcher, - virtual Bits::Dispatcher + struct EdgeBase: EdgeDispatcher, NodeDispatcher { - Void - node_traverser (NodeDispatcherBase& d) + void + node_traverser (NodeDispatcher& d) { - Bits::Dispatcher::traverser (d); + NodeDispatcher::traverser (d); } - NodeDispatcherBase& + NodeDispatcher& node_traverser () { return *this; } - public: - using Bits::Dispatcher::dispatch; - using Bits::Dispatcher::dispatch; + using EdgeDispatcher::dispatch; + using NodeDispatcher::dispatch; - using Bits::Dispatcher::map; - - using Bits::Dispatcher::iterate_and_dispatch; - }; - - template - struct Edge : Bits::TraverserBase, virtual EdgeBase - { - typedef - T - Type; - - Edge () - { - map (typeid (Type), *this); - } - - virtual Void - traverse (Type&) = 0; - - virtual Void - trampoline (SemanticGraph::Edge& i) - { - traverse (dynamic_cast (i)); - } - - virtual Void - trampoline (SemanticGraph::Edge const&) - { - abort (); - } + using NodeDispatcher::iterate_and_dispatch; }; - inline - EdgeBase& + inline EdgeBase& operator>> (NodeBase& n, EdgeBase& e) { n.edge_traverser (e); return e; } - inline - NodeBase& + inline NodeBase& operator>> (EdgeBase& e, NodeBase& n) { e.node_traverser (n); return n; } + // + // + template + struct Node: compiler::traverser_impl, + virtual NodeBase + { + typedef T Type; + }; + + template + struct Edge: compiler::traverser_impl, + virtual EdgeBase + { + typedef T Type; + }; + + // // Edges // @@ -176,7 +108,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.named ()); @@ -197,18 +129,17 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.type ()); } }; - + // // Nodes // - // // struct Nameable : Node @@ -222,20 +153,20 @@ namespace XSDFrontend struct ScopeTemplate : Node { public: - virtual Void + virtual void traverse (T& s) { names (s); } template - Void + void names (T& s, - EdgeDispatcherBase& d, - Void (X::*pre_) (T&) = (Void (ScopeTemplate::*)(T&)) (0), - Void (X::*post_) (T&) = (Void (ScopeTemplate::*)(T&)) (0), - Void (X::*none_) (T&) = (Void (ScopeTemplate::*)(T&)) (0), - Void (X::*next_) (T&) = (Void (ScopeTemplate::*)(T&)) (0)) + EdgeDispatcher& d, + void (X::*pre_) (T&) = (void (ScopeTemplate::*)(T&)) (0), + void (X::*post_) (T&) = (void (ScopeTemplate::*)(T&)) (0), + void (X::*none_) (T&) = (void (ScopeTemplate::*)(T&)) (0), + void (X::*next_) (T&) = (void (ScopeTemplate::*)(T&)) (0)) { X* this_ (dynamic_cast (this)); @@ -266,13 +197,13 @@ namespace XSDFrontend } } - virtual Void - names (T& s, EdgeDispatcherBase& d) + virtual void + names (T& s, EdgeDispatcher& d) { names > (s, d); } - virtual Void + virtual void names (T& s) { names (s, @@ -283,22 +214,22 @@ namespace XSDFrontend &ScopeTemplate::names_next); } - virtual Void + virtual void names_pre (T&) { } - virtual Void + virtual void names_next (T&) { } - virtual Void + virtual void names_post (T&) { } - virtual Void + virtual void names_none (T&) { } @@ -316,7 +247,7 @@ namespace XSDFrontend // struct Type : Node { - virtual Void + virtual void traverse (SemanticGraph::Type&) = 0; }; @@ -325,19 +256,19 @@ namespace XSDFrontend // struct Instance : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void - belongs (Type&, EdgeDispatcherBase&); + virtual void + belongs (Type&, EdgeDispatcher&); - virtual Void + virtual void belongs (Type&); - virtual Void + virtual void post (Type&); }; @@ -346,19 +277,19 @@ namespace XSDFrontend // struct Member : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void - belongs (Type&, EdgeDispatcherBase&); + virtual void + belongs (Type&, EdgeDispatcher&); - virtual Void + virtual void belongs (Type&); - virtual Void + virtual void post (Type&); }; @@ -376,7 +307,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.base ()); @@ -397,7 +328,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.base ()); @@ -418,7 +349,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.base ()); @@ -439,7 +370,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& a) { dispatch (a.type ()); @@ -452,7 +383,7 @@ namespace XSDFrontend // struct Contains : Edge { - virtual Void + virtual void traverse (Type& e) { dispatch (e.element ()); diff --git a/libxsd-frontend/xsd-frontend/traversal/elements.txx b/libxsd-frontend/xsd-frontend/traversal/elements.txx index b673a8d..5b1aec0 100644 --- a/libxsd-frontend/xsd-frontend/traversal/elements.txx +++ b/libxsd-frontend/xsd-frontend/traversal/elements.txx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/elements.txx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file namespace XSDFrontend diff --git a/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx b/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx index a8a49a5..124606f 100644 --- a/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/enumeration.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/enumeration.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -11,7 +10,7 @@ namespace XSDFrontend { // Enumeration // - Void Enumeration:: + void Enumeration:: traverse (Type& e) { pre (e); @@ -21,30 +20,30 @@ namespace XSDFrontend post (e); } - Void Enumeration:: + void Enumeration:: pre (Type&) { } - Void Enumeration:: + void Enumeration:: name (Type&) { } - Void Enumeration:: + void Enumeration:: inherits (Type& e) { inherits (e, *this); } - Void Enumeration:: - inherits (Type& e, EdgeDispatcherBase& d) + void Enumeration:: + inherits (Type& e, EdgeDispatcher& d) { if (e.inherits_p ()) d.dispatch (e.inherits ()); } - Void Enumeration:: + void Enumeration:: post (Type&) { } @@ -52,7 +51,7 @@ namespace XSDFrontend // Enumerator // - Void Enumerator:: + void Enumerator:: traverse (Type& e) { pre (e); @@ -61,29 +60,29 @@ namespace XSDFrontend post (e); } - Void Enumerator:: + void Enumerator:: pre (Type&) { } - Void Enumerator:: - belongs (Type& e, EdgeDispatcherBase& d) + void Enumerator:: + belongs (Type& e, EdgeDispatcher& d) { d.dispatch (e.belongs ()); } - Void Enumerator:: + void Enumerator:: belongs (Type& e) { belongs (e, edge_traverser ()); } - Void Enumerator:: + void Enumerator:: name (Type&) { } - Void Enumerator:: + void Enumerator:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx b/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx index c6d7f04..960b11c 100644 --- a/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/enumeration.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/enumeration.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_ENUMERATION_HXX @@ -15,43 +14,43 @@ namespace XSDFrontend { struct Enumeration : ScopeTemplate { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void name (Type&); - virtual Void + virtual void inherits (Type&); - Void - inherits (Type&, EdgeDispatcherBase&); + void + inherits (Type&, EdgeDispatcher&); - virtual Void + virtual void post (Type&); }; struct Enumerator : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void - belongs (Type&, EdgeDispatcherBase&); + virtual void + belongs (Type&, EdgeDispatcher&); - virtual Void + virtual void belongs (Type&); - virtual Void + virtual void name (Type&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx b/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx index b9cadec..5202adf 100644 --- a/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/fundamental.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/fundamental.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include diff --git a/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx b/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx index 5c20d9c..0b771cd 100644 --- a/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/fundamental.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_FUNDAMENTAL_HXX diff --git a/libxsd-frontend/xsd-frontend/traversal/list.cxx b/libxsd-frontend/xsd-frontend/traversal/list.cxx index ec434ba..9241af1 100644 --- a/libxsd-frontend/xsd-frontend/traversal/list.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/list.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/list.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -9,7 +8,7 @@ namespace XSDFrontend { namespace Traversal { - Void List:: + void List:: traverse (Type& l) { pre (l); @@ -18,29 +17,29 @@ namespace XSDFrontend post (l); } - Void List:: + void List:: pre (Type&) { } - Void List:: + void List:: argumented (Type& l) { argumented (l, *this); } - Void List:: - argumented (Type& l, EdgeDispatcherBase& d) + void List:: + argumented (Type& l, EdgeDispatcher& d) { d.dispatch (l.argumented ()); } - Void List:: + void List:: name (Type&) { } - Void List:: + void List:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/list.hxx b/libxsd-frontend/xsd-frontend/traversal/list.hxx index 2bbc136..06aa154 100644 --- a/libxsd-frontend/xsd-frontend/traversal/list.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/list.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/list.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_LIST_HXX @@ -15,22 +14,22 @@ namespace XSDFrontend { struct List: Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void argumented (Type&); - virtual Void - argumented (Type&, EdgeDispatcherBase& d); + virtual void + argumented (Type&, EdgeDispatcher& d); - virtual Void + virtual void name (Type&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/namespace.cxx b/libxsd-frontend/xsd-frontend/traversal/namespace.cxx index cbc6ef2..fbf1105 100644 --- a/libxsd-frontend/xsd-frontend/traversal/namespace.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/namespace.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/namespace.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include diff --git a/libxsd-frontend/xsd-frontend/traversal/namespace.hxx b/libxsd-frontend/xsd-frontend/traversal/namespace.hxx index 22305e1..0dd0901 100644 --- a/libxsd-frontend/xsd-frontend/traversal/namespace.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/namespace.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/namespace.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_NAMESPACE_HXX @@ -15,7 +14,7 @@ namespace XSDFrontend { struct Namespace: ScopeTemplate { - virtual Void + virtual void traverse (Type& m) { pre (m); @@ -24,17 +23,17 @@ namespace XSDFrontend post (m); } - virtual Void + virtual void pre (Type&) { } - virtual Void + virtual void name (Type&) { } - virtual Void + virtual void post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/particle.cxx b/libxsd-frontend/xsd-frontend/traversal/particle.cxx index e3d3a97..1dd0ce0 100644 --- a/libxsd-frontend/xsd-frontend/traversal/particle.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/particle.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/particle.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -11,19 +10,19 @@ namespace XSDFrontend { // Particle // - Void Particle:: + void Particle:: traverse (Type& c) { pre (c); post (c); } - Void Particle:: + void Particle:: pre (Type&) { } - Void Particle:: + void Particle:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/particle.hxx b/libxsd-frontend/xsd-frontend/traversal/particle.hxx index 3584c12..5346ae9 100644 --- a/libxsd-frontend/xsd-frontend/traversal/particle.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/particle.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/particle.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_PARTICLE_HXX @@ -15,13 +14,13 @@ namespace XSDFrontend { struct Particle : Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/traversal/schema.cxx b/libxsd-frontend/xsd-frontend/traversal/schema.cxx index acfca26..090e964 100644 --- a/libxsd-frontend/xsd-frontend/traversal/schema.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/schema.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/schema.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include diff --git a/libxsd-frontend/xsd-frontend/traversal/schema.hxx b/libxsd-frontend/xsd-frontend/traversal/schema.hxx index a975475..a38ddfd 100644 --- a/libxsd-frontend/xsd-frontend/traversal/schema.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/schema.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/schema.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_SCHEMA_HXX @@ -26,7 +25,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.schema ()); @@ -46,7 +45,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.schema ()); @@ -67,7 +66,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.schema ()); @@ -88,7 +87,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.schema ()); @@ -109,7 +108,7 @@ namespace XSDFrontend node_traverser (n); } - virtual Void + virtual void traverse (Type& e) { dispatch (e.schema ()); @@ -121,7 +120,7 @@ namespace XSDFrontend // struct Schema: ScopeTemplate { - virtual Void + virtual void traverse (Type& s) { pre (s); @@ -134,12 +133,12 @@ namespace XSDFrontend post (s); } - virtual Void + virtual void pre (Type&) { } - virtual Void + virtual void post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/union.cxx b/libxsd-frontend/xsd-frontend/traversal/union.cxx index acf419a..fe8f7d0 100644 --- a/libxsd-frontend/xsd-frontend/traversal/union.cxx +++ b/libxsd-frontend/xsd-frontend/traversal/union.cxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/union.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -9,7 +8,7 @@ namespace XSDFrontend { namespace Traversal { - Void Union:: + void Union:: traverse (Type& u) { pre (u); @@ -18,29 +17,29 @@ namespace XSDFrontend post (u); } - Void Union:: + void Union:: pre (Type&) { } - Void Union:: + void Union:: argumented (Type& u) { argumented (u, *this); } - Void Union:: - argumented (Type& u, EdgeDispatcherBase& d) + void Union:: + argumented (Type& u, EdgeDispatcher& d) { iterate_and_dispatch (u.argumented_begin (), u.argumented_end (), d); } - Void Union:: + void Union:: name (Type&) { } - Void Union:: + void Union:: post (Type&) { } diff --git a/libxsd-frontend/xsd-frontend/traversal/union.hxx b/libxsd-frontend/xsd-frontend/traversal/union.hxx index e3d31bd..8012036 100644 --- a/libxsd-frontend/xsd-frontend/traversal/union.hxx +++ b/libxsd-frontend/xsd-frontend/traversal/union.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/traversal/union.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TRAVERSAL_UNION_HXX @@ -15,22 +14,22 @@ namespace XSDFrontend { struct Union: Node { - virtual Void + virtual void traverse (Type&); - virtual Void + virtual void pre (Type&); - virtual Void + virtual void argumented (Type&); - virtual Void - argumented (Type&, EdgeDispatcherBase& d); + virtual void + argumented (Type&, EdgeDispatcher& d); - virtual Void + virtual void name (Type&); - virtual Void + virtual void post (Type&); }; } diff --git a/libxsd-frontend/xsd-frontend/types.cxx b/libxsd-frontend/xsd-frontend/types.cxx new file mode 100644 index 0000000..49faf92 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/types.cxx @@ -0,0 +1,61 @@ +// file : xsd-frontend/types.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include // std::mbstowcs + +#include + +namespace XSDFrontend +{ + // NonRepresentable + // + char const* NonRepresentable:: + what () const throw () + { + return "character is not representable in the narrower encoding"; + } + + // StringTemplate + // + + // Specialization for char to wchar_t conversion. + // + template <> + void StringTemplate:: + from_narrow (char const* s) + { + size_type size (std::mbstowcs (0, s, 0) + 1); + + // I dare to change the guts! + // + resize (size - 1); + + wchar_t* p (const_cast (data ())); + + std::mbstowcs (p, s, size); + } + + // Specialization for wchar_t to char conversion. + // + template <> + StringTemplate StringTemplate:: + to_narrow () const + { + size_type size (std::wcstombs (0, c_str (), 0)); + + if (size == size_type (-1)) + throw NonRepresentable (); + + // I dare to change the guts! + // + StringTemplate r; + r.resize (size); + + char* p (const_cast (r.data ())); + + std::wcstombs (p, c_str (), size + 1); + + return r; + } +} diff --git a/libxsd-frontend/xsd-frontend/types.hxx b/libxsd-frontend/xsd-frontend/types.hxx index b3059fd..0cd1ad1 100644 --- a/libxsd-frontend/xsd-frontend/types.hxx +++ b/libxsd-frontend/xsd-frontend/types.hxx @@ -1,18 +1,250 @@ // file : xsd-frontend/types.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_TYPES_HXX #define XSD_FRONTEND_TYPES_HXX -#include +#include +#include // std::size_t namespace XSDFrontend { - using namespace Cult::Types; + using std::size_t; - typedef Cult::WideString String; + namespace Bits + { + struct None {}; + + template + struct NarrowerChar + { + typedef None Type; + }; + + template <> + struct NarrowerChar + { + typedef char Type; + }; + } + + struct NonRepresentable: std::exception + { + virtual char const* + what () const throw (); + }; + + template ::Type> + class StringTemplate; + + template <> + class StringTemplate + { + }; + + template + class StringTemplate : public std::basic_string + { + typedef std::basic_string Base; + typedef std::basic_string NarrowerBase; + + Base& + base () + { + return *this; + } + + Base const& + base () const + { + return *this; + } + + public: + typedef typename Base::size_type size_type; + + using Base::npos; + + public: + StringTemplate () + { + } + + StringTemplate (StringTemplate const& str, + size_type pos, + size_type n = npos) + : Base (str, pos, n) + { + } + + StringTemplate (C const* s, size_type n) + : Base (s, n) + { + } + + StringTemplate (C const* s) + : Base (s) + { + } + + StringTemplate (size_type n, C c) + : Base (n, c) + { + } + + template + StringTemplate(I begin, I end) + : Base (begin, end) + { + } + + StringTemplate (StringTemplate const& other) + : Base (other) + { + } + + // Conversion from Base. + // + StringTemplate (Base const& str) + : Base (str) + { + } + + // Conversion from the Narrower type. Experimental. + // + StringTemplate (NC const* s) + { + from_narrow (s); + } + + StringTemplate (StringTemplate const& other) + { + from_narrow (other.c_str ()); + } + + StringTemplate (NarrowerBase const& other) + { + from_narrow (other.c_str ()); + } + + // Assignment. + // + StringTemplate& + operator= (StringTemplate const& str) + { + base () = str; + return *this; + } + + StringTemplate& + operator= (C const* s) + { + base () = s; + return *this; + } + + StringTemplate& + operator= (C c) + { + base () = c; + return *this; + } + + // Assignment from Base. + // + StringTemplate& + operator= (Base const& str) + { + base () = str; + return *this; + } + + public: + StringTemplate& + operator+= (StringTemplate const& str) + { + base () += str; + return *this; + } + + StringTemplate& + operator+= (C const* s) + { + base () += s; + return *this; + } + + StringTemplate& + operator+= (C c) + { + base () += c; + return *this; + } + + // Conversion to the Narrower type. + // + public: + StringTemplate + to_narrow () const; + + // Conversion to bool. + // + private: + typedef void (StringTemplate::*BooleanConvertible)(); + void true_ () {} + + public: + operator BooleanConvertible () const + { + return this->empty () ? 0 : &StringTemplate::true_; + } + + private: + void + from_narrow (NC const* s); + }; + + + template + StringTemplate + operator+ (StringTemplate const& lhs, StringTemplate const& rhs) + { + return StringTemplate (lhs) += rhs; + } + + template + StringTemplate + operator+ (C const* lhs, StringTemplate const& rhs) + { + return StringTemplate (lhs) += rhs; + } + + template + StringTemplate + operator+ (StringTemplate const& lhs, C const* rhs) + { + return StringTemplate (lhs) += rhs; + } + + template + StringTemplate + operator+ (C lhs, StringTemplate const& rhs) + { + return StringTemplate (1, lhs) += rhs; + } + + template + StringTemplate + operator+ (StringTemplate const& lhs, C rhs) + { + return StringTemplate (lhs) += rhs; + } + + typedef StringTemplate NarrowString; + typedef StringTemplate WideString; + + typedef WideString String; } #endif // XSD_FRONTEND_TYPES_HXX diff --git a/libxsd-frontend/xsd-frontend/version.hxx b/libxsd-frontend/xsd-frontend/version.hxx new file mode 100644 index 0000000..fa6d1de --- /dev/null +++ b/libxsd-frontend/xsd-frontend/version.hxx @@ -0,0 +1,14 @@ +// file : xsd-frontend/version.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_FRONTEND_VERSION_HXX +#define XSD_FRONTEND_VERSION_HXX + +#include + +#if _XERCES_VERSION < 30000 +# error Xerces-C++ 2-series is not supported +#endif + +#endif // XSD_FRONTEND_VERSION_HXX diff --git a/libxsd-frontend/xsd-frontend/xml.hxx b/libxsd-frontend/xsd-frontend/xml.hxx index 8c9b01c..d33f6bf 100644 --- a/libxsd-frontend/xsd-frontend/xml.hxx +++ b/libxsd-frontend/xsd-frontend/xml.hxx @@ -1,18 +1,17 @@ // file : xsd-frontend/xml.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_XML_HXX #define XSD_FRONTEND_XML_HXX +#include #include #include #include -#include - +#include // Check Xerces-C++ version. #include #include @@ -24,9 +23,9 @@ namespace XSDFrontend inline String - transcode (XMLCh const* s, Size length) + transcode (XMLCh const* s, size_t length) { - if (sizeof (WideChar) == 4) + if (sizeof (wchar_t) == 4) { // UTF-32 // @@ -34,8 +33,8 @@ namespace XSDFrontend // Find what the resulting buffer size will be. // - Size rl (0); - Boolean valid (true); + size_t rl (0); + bool valid (true); for (XMLCh const* p (s); p < end; ++p) { @@ -60,27 +59,27 @@ namespace XSDFrontend String r; r.reserve (rl + 1); r.resize (rl); - WideChar* rs (const_cast (r.c_str ())); + wchar_t* rs (const_cast (r.c_str ())); - Size i (0); + size_t i (0); for (XMLCh const* p (s); p < end; ++p) { XMLCh x (*p); if (x < 0xD800 || x > 0xDBFF) - rs[i++] = WideChar (x); + rs[i++] = wchar_t (x); else rs[i++] = ((x - 0xD800) << 10) + (*++p - 0xDC00) + 0x10000; } return r; } - else if (sizeof (WideChar) == 2) + else if (sizeof (wchar_t) == 2) { // UTF-16 // - return String (reinterpret_cast (s), length); + return String (reinterpret_cast (s), length); } else return String (); @@ -97,7 +96,7 @@ namespace XSDFrontend NarrowString transcode_to_narrow (XMLCh const* xs) { - Char* s (Xerces::XMLString::transcode (xs)); + char* s (Xerces::XMLString::transcode (xs)); NarrowString r (s); Xerces::XMLString::release (&s); return r; @@ -107,16 +106,16 @@ namespace XSDFrontend XMLCh* transcode (String const& str) { - Size l (str.size ()); - WideChar const* s (str.c_str ()); + size_t l (str.size ()); + wchar_t const* s (str.c_str ()); - if (sizeof (WideChar) == 4) + if (sizeof (wchar_t) == 4) { // Find what the resulting buffer size will be. // - Size rl (0); + size_t rl (0); - for (WideChar const* p (s); p < s + l; ++p) + for (wchar_t const* p (s); p < s + l; ++p) { rl += (*p & 0xFFFF0000) ? 2 : 1; } @@ -124,9 +123,9 @@ namespace XSDFrontend XMLCh* r (new XMLCh[rl + 1]); XMLCh* ir (r); - for (WideChar const* p (s); p < s + l; ++p) + for (wchar_t const* p (s); p < s + l; ++p) { - WideChar w (*p); + wchar_t w (*p); if (w & 0xFFFF0000) { @@ -143,12 +142,12 @@ namespace XSDFrontend return r; } - else if (sizeof (WideChar) == 2) + else if (sizeof (wchar_t) == 2) { XMLCh* r (new XMLCh[l + 1]); XMLCh* ir (r); - for (Size i (0); i < l; ++ir, ++i) + for (size_t i (0); i < l; ++ir, ++i) *ir = static_cast (s[i]); *ir = XMLCh (0); @@ -167,7 +166,7 @@ namespace XSDFrontend { } - XMLChString (WideChar const* s) + XMLChString (wchar_t const* s) : s_ (transcode (String (s))) { } @@ -217,20 +216,20 @@ namespace XSDFrontend } public: - UnsignedLong + unsigned long line () const { //@@ cache // - return reinterpret_cast (e_->getUserData (line_key)); + return reinterpret_cast (e_->getUserData (line_key)); } - UnsignedLong + unsigned long column () const { //@@ cache // - return reinterpret_cast (e_->getUserData (column_key)); + return reinterpret_cast (e_->getUserData (column_key)); } public: @@ -243,7 +242,7 @@ namespace XSDFrontend public: // Attribute identified by a name. // - Boolean + bool attribute_p (String const& name) const { return attribute_p ("", name); @@ -264,7 +263,7 @@ namespace XSDFrontend // Attribute identified by namespace and name. // - Boolean + bool attribute_p (String const& namespace_, String const& name) const { Xerces::DOMAttr* a ( @@ -303,7 +302,7 @@ namespace XSDFrontend inline String prefix (String const& n) { - Size i (0); + size_t i (0); while (i < n.length () && n[i] != L':') ++i; //std::wcerr << "prefix " << n << " " @@ -315,7 +314,7 @@ namespace XSDFrontend inline String uq_name (String const& n) { - Size i (0); + size_t i (0); while (i < n.length () && n[i] != L':') ++i; return String (n.c_str () + (i == n.length () ? 0 : i + 1)); @@ -367,18 +366,11 @@ namespace XSDFrontend ns_prefix (Element const& e, String const& wns) { XMLChString ns (wns); - -#if _XERCES_VERSION >= 30000 - XMLCh const* p ( - e.dom_element ()->lookupPrefix (ns.c_str ())); -#else - XMLCh const* p ( - e.dom_element ()->lookupNamespacePrefix (ns.c_str (), false)); -#endif + XMLCh const* p (e.dom_element ()->lookupPrefix (ns.c_str ())); if (p == 0) { - Boolean r (e.dom_element ()->isDefaultNamespace (ns.c_str ())); + bool r (e.dom_element ()->isDefaultNamespace (ns.c_str ())); if (r) return L""; @@ -518,9 +510,9 @@ namespace XSDFrontend // Conversion to bool. // - typedef X* (AutoPtr::*BooleanConvertible)() const; + typedef X* (AutoPtr::*boolConvertible)() const; - operator BooleanConvertible () const throw () + operator boolConvertible () const throw () { return x_ ? &AutoPtr::operator-> : 0; } @@ -530,13 +522,13 @@ namespace XSDFrontend }; template - struct PtrVector: Cult::Containers::Vector + struct PtrVector: std::vector { - typedef Cult::Containers::Vector Base; + typedef std::vector Base; ~PtrVector () { - for (typename Base::Iterator i (this->begin ()), e (this->end ()); + for (typename Base::iterator i (this->begin ()), e (this->end ()); i != e; ++i) { if (*i) @@ -544,7 +536,7 @@ namespace XSDFrontend } } - Void + void push_back (AutoPtr& x) { Base::push_back (0); -- cgit v1.2.3