diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-07 09:35:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-07 09:35:54 +0200 |
commit | 900cdb2da86c6a9c523bac093aef482a1f1033e3 (patch) | |
tree | e9f169568996c40924a779cdc8f0b3f8c07813e1 | |
parent | 25cc7b7193999f095707028c5a315bc6bc95c82a (diff) |
Get rid of dependency on libfrontend-elements
Use libcutl facilities instead.
48 files changed, 616 insertions, 1129 deletions
diff --git a/build/import/libcutl/LICENSE b/build/import/libcutl/LICENSE new file mode 100644 index 0000000..6b90d44 --- /dev/null +++ b/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/build/import/libcutl/configuration-rules.make b/build/import/libcutl/configuration-rules.make new file mode 100644 index 0000000..b9fcabc --- /dev/null +++ b/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/build/import/libcutl/configure b/build/import/libcutl/configure new file mode 100755 index 0000000..8adb631 --- /dev/null +++ b/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/build/import/libcutl/stub.make b/build/import/libcutl/stub.make new file mode 100644 index 0000000..1ec4716 --- /dev/null +++ b/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/build/import/libfrontend-elements/LICENSE b/build/import/libfrontend-elements/LICENSE deleted file mode 100644 index 3912109..0000000 --- a/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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/build/import/libfrontend-elements/configuration-rules.make b/build/import/libfrontend-elements/configuration-rules.make deleted file mode 100644 index a7db697..0000000 --- a/build/import/libfrontend-elements/configuration-rules.make +++ /dev/null @@ -1,15 +0,0 @@ -# file : build/import/libfrontend-elements/configuration-rules.make -# author : Boris Kolpackov <boris@kolpackov.net> -# 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/build/import/libfrontend-elements/configure b/build/import/libfrontend-elements/configure deleted file mode 100755 index d02b4f7..0000000 --- a/build/import/libfrontend-elements/configure +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env bash - -# file : build/import/libfrontend-elements/configure -# author : Boris Kolpackov <boris@kolpackov.net> -# 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/build/import/libfrontend-elements/stub.make b/build/import/libfrontend-elements/stub.make deleted file mode 100644 index d701305..0000000 --- a/build/import/libfrontend-elements/stub.make +++ /dev/null @@ -1,30 +0,0 @@ -# file : build/import/libfrontend-elements/stub.make -# author : Boris Kolpackov <boris@kolpackov.net> -# 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/xsd-frontend/makefile b/xsd-frontend/makefile index 8a8a759..010ec7d 100644 --- a/xsd-frontend/makefile +++ b/xsd-frontend/makefile @@ -68,23 +68,23 @@ $(call import,\ 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) + $(scf_root)/import/libcult/stub.make,\ + l: cult.l,cpp-options: cult.l.cpp-options) # what to build # -$(xsd_frontend.l): $(cxx_obj) $(fe.l) $(cult.l) $(xerces_c.l) $(fs.l) +$(xsd_frontend.l): $(cxx_obj) $(cult.l) $(cutl.l) $(xerces_c.l) $(fs.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) + $(cult.l.cpp-options) \ + $(cutl.l.cpp-options) #@@ This can be further optimized since only parser depends on xerces. # diff --git a/xsd-frontend/parser.cxx b/xsd-frontend/parser.cxx index 550f883..84da4d1 100644 --- a/xsd-frontend/parser.cxx +++ b/xsd-frontend/parser.cxx @@ -1089,7 +1089,7 @@ namespace XSDFrontend // the name from the prototype. UnsignedLong count; - FrontendElements::Context& ctx (scope.context ()); + SemanticGraph::Context& ctx (scope.context ()); if (!ctx.count ("any-name-count")) { @@ -1251,7 +1251,7 @@ namespace XSDFrontend // reuse the name from the attribute group. UnsignedLong count; - FrontendElements::Context& ctx (s.context ()); + SemanticGraph::Context& ctx (s.context ()); if (!ctx.count ("any-attribute-name-count")) { @@ -1990,7 +1990,7 @@ namespace XSDFrontend Traversal::Element, Traversal::Member { - AnonymousMember (Traversal::NodeDispatcherBase& d) + AnonymousMember (Traversal::NodeDispatcher& d) { belongs_.node_traverser (d); } @@ -2028,7 +2028,7 @@ namespace XSDFrontend struct AnonymousBase: Traversal::Type { - AnonymousBase (Traversal::NodeDispatcherBase& d) + AnonymousBase (Traversal::NodeDispatcher& d) : base_ (d) { } @@ -2041,7 +2041,7 @@ namespace XSDFrontend } private: - Traversal::NodeDispatcherBase& base_; + Traversal::NodeDispatcher& base_; } anonymous_base (resolver); ns_names >> resolver; @@ -2237,7 +2237,7 @@ namespace XSDFrontend Traversal::Element, Traversal::Member { - AnonymousMember (Traversal::NodeDispatcherBase& d) + AnonymousMember (Traversal::NodeDispatcher& d) { belongs_.node_traverser (d); } @@ -2275,7 +2275,7 @@ namespace XSDFrontend struct AnonymousBase: Traversal::Type { - AnonymousBase (Traversal::NodeDispatcherBase& d) + AnonymousBase (Traversal::NodeDispatcher& d) : base_ (d) { } @@ -2288,7 +2288,7 @@ namespace XSDFrontend } private: - Traversal::NodeDispatcherBase& base_; + Traversal::NodeDispatcher& base_; } anonymous_base (resolver); ns_names >> resolver; @@ -3523,7 +3523,6 @@ namespace XSDFrontend simple_content_restriction (XML::Element const& r) { String base (trim (r["base"])); - Type* base_type (0); if (trace_ && base) wcout << "restriction base: " << fq_name (r, base) << endl; @@ -3543,7 +3542,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 " @@ -4584,7 +4583,7 @@ namespace XSDFrontend // put it into the scope. // UnsignedLong count; - FrontendElements::Context& ctx (scope ().context ()); + SemanticGraph::Context& ctx (scope ().context ()); if (!ctx.count ("any-name-count")) { @@ -4630,7 +4629,7 @@ namespace XSDFrontend // UnsignedLong count; - FrontendElements::Context& ctx (scope ().context ()); + SemanticGraph::Context& ctx (scope ().context ()); if (!ctx.count ("any-attribute-name-count")) { diff --git a/xsd-frontend/semantic-graph/annotation.cxx b/xsd-frontend/semantic-graph/annotation.cxx index db30fc7..f1bb9b6 100644 --- a/xsd-frontend/semantic-graph/annotation.cxx +++ b/xsd-frontend/semantic-graph/annotation.cxx @@ -3,17 +3,15 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/annotation.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + using compiler::type_info; // Annotates // @@ -23,11 +21,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 +36,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/xsd-frontend/semantic-graph/any-attribute.cxx b/xsd-frontend/semantic-graph/any-attribute.cxx index 799cee4..3177f80 100644 --- a/xsd-frontend/semantic-graph/any-attribute.cxx +++ b/xsd-frontend/semantic-graph/any-attribute.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/any-attribute.hxx> #include <xsd-frontend/semantic-graph/compositors.hxx> @@ -10,25 +12,6 @@ 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, @@ -110,5 +93,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/xsd-frontend/semantic-graph/any.cxx b/xsd-frontend/semantic-graph/any.cxx index bfa3055..02f4199 100644 --- a/xsd-frontend/semantic-graph/any.cxx +++ b/xsd-frontend/semantic-graph/any.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/any.hxx> #include <xsd-frontend/semantic-graph/compositors.hxx> @@ -10,26 +12,6 @@ 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, @@ -121,5 +103,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/xsd-frontend/semantic-graph/attribute-group.cxx b/xsd-frontend/semantic-graph/attribute-group.cxx index 6a45bbd..d966cea 100644 --- a/xsd-frontend/semantic-graph/attribute-group.cxx +++ b/xsd-frontend/semantic-graph/attribute-group.cxx @@ -3,37 +3,33 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/attribute-group.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + AttributeGroup:: + AttributeGroup (Path const& file, UnsignedLong line, UnsignedLong 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/xsd-frontend/semantic-graph/attribute.cxx b/xsd-frontend/semantic-graph/attribute.cxx index f5f7522..794832c 100644 --- a/xsd-frontend/semantic-graph/attribute.cxx +++ b/xsd-frontend/semantic-graph/attribute.cxx @@ -3,31 +3,14 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/attribute.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct AttributeInit - { - AttributeInit () - { - TypeInfo ti (typeid (Attribute)); - ti.add_base (Access::public_, true, typeid (Member)); - RTTI::insert (ti); - } - - } attribute_init_; - } - Attribute:: Attribute (Path const& file, UnsignedLong line, @@ -40,5 +23,20 @@ namespace XSDFrontend optional_ (optional) { } + + namespace + { + using compiler::type_info; + + struct AttributeInit + { + AttributeInit () + { + type_info ti (typeid (Attribute)); + ti.add_base (typeid (Member)); + insert (ti); + } + } attribute_init_; + } } } diff --git a/xsd-frontend/semantic-graph/complex.cxx b/xsd-frontend/semantic-graph/complex.cxx index 6806c47..f17f12c 100644 --- a/xsd-frontend/semantic-graph/complex.cxx +++ b/xsd-frontend/semantic-graph/complex.cxx @@ -3,32 +3,14 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/complex.hxx> 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) @@ -41,5 +23,21 @@ namespace XSDFrontend 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/xsd-frontend/semantic-graph/compositors.cxx b/xsd-frontend/semantic-graph/compositors.cxx index 395f923..8eaa5cf 100644 --- a/xsd-frontend/semantic-graph/compositors.cxx +++ b/xsd-frontend/semantic-graph/compositors.cxx @@ -3,122 +3,99 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/compositors.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // ContainsCompositor + // + ContainsCompositor:: + ContainsCompositor (UnsignedLong min, UnsignedLong max) + : compositor_ (0), container_ (0), min_ (min), max_ (max) + { + } - using RTTI::Access; - using RTTI::TypeInfo; + // All + // + All:: + All (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } + // Choice + // + Choice:: + Choice (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } - // ContainsCompositor + // Sequence // + Sequence:: + Sequence (Path const& file, UnsignedLong line, UnsignedLong 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/xsd-frontend/semantic-graph/element-group.cxx b/xsd-frontend/semantic-graph/element-group.cxx index 17bb5f6..2e42757 100644 --- a/xsd-frontend/semantic-graph/element-group.cxx +++ b/xsd-frontend/semantic-graph/element-group.cxx @@ -3,36 +3,33 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/element-group.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + ElementGroup:: + ElementGroup (Path const& file, UnsignedLong line, UnsignedLong 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/xsd-frontend/semantic-graph/element.cxx b/xsd-frontend/semantic-graph/element.cxx index dc3ad9f..607fd2c 100644 --- a/xsd-frontend/semantic-graph/element.cxx +++ b/xsd-frontend/semantic-graph/element.cxx @@ -3,61 +3,52 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/element.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - - // Substitutes + // Element // + Element:: + Element (Path const& file, + UnsignedLong line, + UnsignedLong column, + Boolean global, + Boolean 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/xsd-frontend/semantic-graph/elements.cxx b/xsd-frontend/semantic-graph/elements.cxx index 25b4c83..36fb9a3 100644 --- a/xsd-frontend/semantic-graph/elements.cxx +++ b/xsd-frontend/semantic-graph/elements.cxx @@ -5,6 +5,8 @@ #include <algorithm> +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/elements.hxx> #include <xsd-frontend/semantic-graph/annotation.hxx> @@ -46,10 +48,7 @@ namespace XSDFrontend argumented_.erase (i); } - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + using compiler::type_info; namespace { @@ -59,209 +58,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 +237,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:: diff --git a/xsd-frontend/semantic-graph/elements.hxx b/xsd-frontend/semantic-graph/elements.hxx index 9bf0462..180a3b4 100644 --- a/xsd-frontend/semantic-graph/elements.hxx +++ b/xsd-frontend/semantic-graph/elements.hxx @@ -14,8 +14,6 @@ #include <cult/types.hxx> -#include <cult/rtti/type-info.hxx> - #include <cult/containers/set.hxx> #include <cult/containers/map.hxx> #include <cult/containers/list.hxx> @@ -23,12 +21,14 @@ #include <cult/containers/graph.hxx> #include <cult/containers/vector.hxx> -#include <frontend-elements/context.hxx> +#include <cutl/compiler/context.hxx> namespace XSDFrontend { namespace SemanticGraph { + using namespace cutl; + using namespace Cult::Types; namespace Bits @@ -164,7 +164,7 @@ namespace XSDFrontend Paths; typedef - FrontendElements::Context + compiler::context Context; // diff --git a/xsd-frontend/semantic-graph/enumeration.cxx b/xsd-frontend/semantic-graph/enumeration.cxx index b4c97fb..adb9704 100644 --- a/xsd-frontend/semantic-graph/enumeration.cxx +++ b/xsd-frontend/semantic-graph/enumeration.cxx @@ -3,30 +3,44 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/enumeration.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // Enumeration + // + Enumeration:: + Enumeration (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } - using RTTI::Access; - using RTTI::TypeInfo; + // Enumerator + // + Enumerator:: + Enumerator (Path const& file, UnsignedLong line, UnsignedLong 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 +50,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/xsd-frontend/semantic-graph/fundamental.cxx.m4 b/xsd-frontend/semantic-graph/fundamental.cxx.m4 index 19e4e89..cf6c17f 100644 --- a/xsd-frontend/semantic-graph/fundamental.cxx.m4 +++ b/xsd-frontend/semantic-graph/fundamental.cxx.m4 @@ -21,9 +21,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_; @@ -49,6 +49,8 @@ dnl // Note, that this file is automatically generated! // +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/fundamental.hxx> namespace XSDFrontend @@ -57,11 +59,7 @@ namespace XSDFrontend { namespace Fundamental { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + using compiler::type_info; // Type // @@ -71,11 +69,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 +135,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_; @@ -164,10 +161,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_; diff --git a/xsd-frontend/semantic-graph/list.cxx b/xsd-frontend/semantic-graph/list.cxx index 36ce3f4..9911b81 100644 --- a/xsd-frontend/semantic-graph/list.cxx +++ b/xsd-frontend/semantic-graph/list.cxx @@ -3,35 +3,33 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/list.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + List:: + List (Path const& file, UnsignedLong line, UnsignedLong 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/xsd-frontend/semantic-graph/namespace.cxx b/xsd-frontend/semantic-graph/namespace.cxx index 8794f8f..a82d1e1 100644 --- a/xsd-frontend/semantic-graph/namespace.cxx +++ b/xsd-frontend/semantic-graph/namespace.cxx @@ -3,35 +3,33 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/namespace.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + Namespace:: + Namespace (Path const& file, UnsignedLong line, UnsignedLong 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/xsd-frontend/semantic-graph/particle.cxx b/xsd-frontend/semantic-graph/particle.cxx index eb08a23..b966086 100644 --- a/xsd-frontend/semantic-graph/particle.cxx +++ b/xsd-frontend/semantic-graph/particle.cxx @@ -3,33 +3,16 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/particle.hxx> 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) : particle_ (0), compositor_ (0), min_ (min), max_ (max) @@ -38,24 +21,35 @@ namespace XSDFrontend // 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/xsd-frontend/semantic-graph/schema.cxx b/xsd-frontend/semantic-graph/schema.cxx index 0bb072f..3ff8c6d 100644 --- a/xsd-frontend/semantic-graph/schema.cxx +++ b/xsd-frontend/semantic-graph/schema.cxx @@ -3,30 +3,63 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/schema.hxx> 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 (); - using RTTI::Access; - using RTTI::TypeInfo; + 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); + } + } 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 +69,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 +82,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 +95,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 +108,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 +121,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/xsd-frontend/semantic-graph/union.cxx b/xsd-frontend/semantic-graph/union.cxx index 76e8382..111dd13 100644 --- a/xsd-frontend/semantic-graph/union.cxx +++ b/xsd-frontend/semantic-graph/union.cxx @@ -3,35 +3,33 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> + #include <xsd-frontend/semantic-graph/union.hxx> namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + Union:: + Union (Path const& file, UnsignedLong line, UnsignedLong 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/xsd-frontend/transformations/anonymous.cxx b/xsd-frontend/transformations/anonymous.cxx index bc21baa..9dcbf45 100644 --- a/xsd-frontend/transformations/anonymous.cxx +++ b/xsd-frontend/transformations/anonymous.cxx @@ -139,7 +139,7 @@ namespace XSDFrontend virtual Void - traverse (SemanticGraph::List& x) + traverse (SemanticGraph::List&) { using SemanticGraph::List; diff --git a/xsd-frontend/transformations/restriction.cxx b/xsd-frontend/transformations/restriction.cxx index 4b5d38b..77c947e 100644 --- a/xsd-frontend/transformations/restriction.cxx +++ b/xsd-frontend/transformations/restriction.cxx @@ -432,14 +432,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_; @@ -501,8 +501,8 @@ 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) { } @@ -518,8 +518,8 @@ namespace XSDFrontend } private: - Traversal::NodeDispatcherBase* d1_; - Traversal::NodeDispatcherBase* d2_; + Traversal::NodeDispatcher* d1_; + Traversal::NodeDispatcher* d2_; } complex_; diff --git a/xsd-frontend/traversal/attribute.cxx b/xsd-frontend/traversal/attribute.cxx index 00344b6..f94aec4 100644 --- a/xsd-frontend/traversal/attribute.cxx +++ b/xsd-frontend/traversal/attribute.cxx @@ -24,7 +24,7 @@ namespace XSDFrontend } Void Attribute:: - belongs (Type& a, EdgeDispatcherBase& d) + belongs (Type& a, EdgeDispatcher& d) { d.dispatch (a.belongs ()); } diff --git a/xsd-frontend/traversal/attribute.hxx b/xsd-frontend/traversal/attribute.hxx index bc36a86..e04df75 100644 --- a/xsd-frontend/traversal/attribute.hxx +++ b/xsd-frontend/traversal/attribute.hxx @@ -24,7 +24,7 @@ namespace XSDFrontend pre (Type&); virtual Void - belongs (Type&, EdgeDispatcherBase&); + belongs (Type&, EdgeDispatcher&); virtual Void belongs (Type&); diff --git a/xsd-frontend/traversal/complex.cxx b/xsd-frontend/traversal/complex.cxx index b014812..9a07382 100644 --- a/xsd-frontend/traversal/complex.cxx +++ b/xsd-frontend/traversal/complex.cxx @@ -37,7 +37,7 @@ namespace XSDFrontend } Void Complex:: - inherits (Type& c, EdgeDispatcherBase& d) + inherits (Type& c, EdgeDispatcher& d) { if (c.inherits_p ()) d.dispatch (c.inherits ()); @@ -50,7 +50,7 @@ namespace XSDFrontend } Void Complex:: - contains_compositor (Type& c, EdgeDispatcherBase& d) + contains_compositor (Type& c, EdgeDispatcher& d) { if (c.contains_compositor_p ()) d.dispatch (c.contains_compositor ()); diff --git a/xsd-frontend/traversal/complex.hxx b/xsd-frontend/traversal/complex.hxx index 5f1e38f..21f42ef 100644 --- a/xsd-frontend/traversal/complex.hxx +++ b/xsd-frontend/traversal/complex.hxx @@ -28,13 +28,13 @@ namespace XSDFrontend inherits (Type&); Void - inherits (Type&, EdgeDispatcherBase&); + inherits (Type&, EdgeDispatcher&); virtual Void contains_compositor (Type&); Void - contains_compositor (Type&, EdgeDispatcherBase&); + contains_compositor (Type&, EdgeDispatcher&); virtual Void post (Type&); diff --git a/xsd-frontend/traversal/compositors.cxx b/xsd-frontend/traversal/compositors.cxx index 0de3819..c68e7a7 100644 --- a/xsd-frontend/traversal/compositors.cxx +++ b/xsd-frontend/traversal/compositors.cxx @@ -50,7 +50,7 @@ namespace XSDFrontend } Void Compositor:: - contains (Type& c, EdgeDispatcherBase& d) + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } @@ -84,7 +84,7 @@ namespace XSDFrontend } Void All:: - contains (Type& c, EdgeDispatcherBase& d) + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } @@ -118,7 +118,7 @@ namespace XSDFrontend } Void Choice:: - contains (Type& c, EdgeDispatcherBase& d) + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } @@ -152,7 +152,7 @@ namespace XSDFrontend } Void Sequence:: - contains (Type& c, EdgeDispatcherBase& d) + contains (Type& c, EdgeDispatcher& d) { iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); } diff --git a/xsd-frontend/traversal/compositors.hxx b/xsd-frontend/traversal/compositors.hxx index a6c9cec..5e099e4 100644 --- a/xsd-frontend/traversal/compositors.hxx +++ b/xsd-frontend/traversal/compositors.hxx @@ -62,7 +62,7 @@ namespace XSDFrontend contains (Type&); virtual Void - contains (Type&, EdgeDispatcherBase&); + contains (Type&, EdgeDispatcher&); virtual Void post (Type&); @@ -83,7 +83,7 @@ namespace XSDFrontend contains (Type&); virtual Void - contains (Type&, EdgeDispatcherBase&); + contains (Type&, EdgeDispatcher&); virtual Void post (Type&); @@ -104,7 +104,7 @@ namespace XSDFrontend contains (Type&); virtual Void - contains (Type&, EdgeDispatcherBase&); + contains (Type&, EdgeDispatcher&); virtual Void post (Type&); @@ -125,7 +125,7 @@ namespace XSDFrontend contains (Type&); virtual Void - contains (Type&, EdgeDispatcherBase&); + contains (Type&, EdgeDispatcher&); virtual Void post (Type&); diff --git a/xsd-frontend/traversal/element-group.cxx b/xsd-frontend/traversal/element-group.cxx index 2129272..1658074 100644 --- a/xsd-frontend/traversal/element-group.cxx +++ b/xsd-frontend/traversal/element-group.cxx @@ -24,7 +24,7 @@ namespace XSDFrontend } Void ElementGroup:: - contains_compositor (Type& g, EdgeDispatcherBase& d) + contains_compositor (Type& g, EdgeDispatcher& d) { d.dispatch (g.contains_compositor ()); } diff --git a/xsd-frontend/traversal/element-group.hxx b/xsd-frontend/traversal/element-group.hxx index ef5bd84..56ddc0f 100644 --- a/xsd-frontend/traversal/element-group.hxx +++ b/xsd-frontend/traversal/element-group.hxx @@ -25,7 +25,7 @@ namespace XSDFrontend contains_compositor (Type&); virtual Void - contains_compositor (Type&, EdgeDispatcherBase&); + contains_compositor (Type&, EdgeDispatcher&); virtual Void post (Type&); diff --git a/xsd-frontend/traversal/element.cxx b/xsd-frontend/traversal/element.cxx index 26ed784..62e5ee8 100644 --- a/xsd-frontend/traversal/element.cxx +++ b/xsd-frontend/traversal/element.cxx @@ -24,7 +24,7 @@ namespace XSDFrontend } Void Element:: - belongs (Type& m, EdgeDispatcherBase& d) + belongs (Type& m, EdgeDispatcher& d) { d.dispatch (m.belongs ()); } diff --git a/xsd-frontend/traversal/element.hxx b/xsd-frontend/traversal/element.hxx index c77dd1d..3e54950 100644 --- a/xsd-frontend/traversal/element.hxx +++ b/xsd-frontend/traversal/element.hxx @@ -22,7 +22,7 @@ namespace XSDFrontend pre (Type&); virtual Void - belongs (Type&, EdgeDispatcherBase&); + belongs (Type&, EdgeDispatcher&); virtual Void belongs (Type&); diff --git a/xsd-frontend/traversal/elements.cxx b/xsd-frontend/traversal/elements.cxx index 84d076a..f8bc283 100644 --- a/xsd-frontend/traversal/elements.cxx +++ b/xsd-frontend/traversal/elements.cxx @@ -25,7 +25,7 @@ namespace XSDFrontend } Void Instance:: - belongs (Type& a, EdgeDispatcherBase& d) + belongs (Type& a, EdgeDispatcher& d) { d.dispatch (a.belongs ()); } @@ -58,7 +58,7 @@ namespace XSDFrontend } Void Member:: - belongs (Type& a, EdgeDispatcherBase& d) + belongs (Type& a, EdgeDispatcher& d) { d.dispatch (a.belongs ()); } diff --git a/xsd-frontend/traversal/elements.hxx b/xsd-frontend/traversal/elements.hxx index 3acb0b5..35604e8 100644 --- a/xsd-frontend/traversal/elements.hxx +++ b/xsd-frontend/traversal/elements.hxx @@ -8,7 +8,7 @@ #include <cult/types.hxx> -#include <frontend-elements/traversal.hxx> +#include <cutl/compiler/traversal.hxx> #include <xsd-frontend/semantic-graph/elements.hxx> @@ -16,150 +16,85 @@ namespace XSDFrontend { namespace Traversal { + using namespace cutl; 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<SemanticGraph::Node> NodeDispatcherBase; - typedef Bits::DispatcherBase<SemanticGraph::Edge> EdgeDispatcherBase; - + typedef compiler::dispatcher<SemanticGraph::Node> NodeDispatcher; + typedef compiler::dispatcher<SemanticGraph::Edge> EdgeDispatcher; // // - struct NodeBase : virtual Bits::Dispatcher<SemanticGraph::Node>, - virtual Bits::Dispatcher<SemanticGraph::Edge> + struct NodeBase: NodeDispatcher, EdgeDispatcher { Void - edge_traverser (EdgeDispatcherBase& d) + edge_traverser (EdgeDispatcher& d) { - Bits::Dispatcher<SemanticGraph::Edge>::traverser (d); + EdgeDispatcher::traverser (d); } - EdgeDispatcherBase& + EdgeDispatcher& edge_traverser () { return *this; } - public: - using Bits::Dispatcher<SemanticGraph::Node>::dispatch; - using Bits::Dispatcher<SemanticGraph::Edge>::dispatch; - - using Bits::Dispatcher<SemanticGraph::Node>::map; - - using Bits::Dispatcher<SemanticGraph::Edge>::iterate_and_dispatch; - }; - - - // - // - template <typename T> - struct Node : Bits::TraverserBase<SemanticGraph::Node>, virtual NodeBase - { - typedef - T - Type; - - Node () - { - map (typeid (Type), *this); - } - - virtual Void - traverse (Type&) = 0; - - virtual Void - trampoline (SemanticGraph::Node& i) - { - traverse (dynamic_cast<Type&> (i)); - } + using NodeDispatcher::dispatch; + using EdgeDispatcher::dispatch; - virtual Void - trampoline (SemanticGraph::Node const&) - { - abort (); - } + using EdgeDispatcher::iterate_and_dispatch; }; - - // - // - struct EdgeBase : virtual Bits::Dispatcher<SemanticGraph::Edge>, - virtual Bits::Dispatcher<SemanticGraph::Node> + struct EdgeBase: EdgeDispatcher, NodeDispatcher { Void - node_traverser (NodeDispatcherBase& d) + node_traverser (NodeDispatcher& d) { - Bits::Dispatcher<SemanticGraph::Node>::traverser (d); + NodeDispatcher::traverser (d); } - NodeDispatcherBase& + NodeDispatcher& node_traverser () { return *this; } - public: - using Bits::Dispatcher<SemanticGraph::Edge>::dispatch; - using Bits::Dispatcher<SemanticGraph::Node>::dispatch; - - using Bits::Dispatcher<SemanticGraph::Edge>::map; - - using Bits::Dispatcher<SemanticGraph::Node>::iterate_and_dispatch; - }; - - template <typename T> - struct Edge : Bits::TraverserBase<SemanticGraph::Edge>, virtual EdgeBase - { - typedef - T - Type; - - Edge () - { - map (typeid (Type), *this); - } - - virtual Void - traverse (Type&) = 0; - - virtual Void - trampoline (SemanticGraph::Edge& i) - { - traverse (dynamic_cast<Type&> (i)); - } + using EdgeDispatcher::dispatch; + using NodeDispatcher::dispatch; - 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 <typename T> + struct Node: compiler::traverser_impl<T, SemanticGraph::Node>, + virtual NodeBase + { + typedef T Type; + }; + + template <typename T> + struct Edge: compiler::traverser_impl<T, SemanticGraph::Edge>, + virtual EdgeBase + { + typedef T Type; + }; + + // // Edges // @@ -204,11 +139,10 @@ namespace XSDFrontend } }; - + // // Nodes // - // // struct Nameable : Node<SemanticGraph::Nameable> @@ -231,7 +165,7 @@ namespace XSDFrontend template<typename X> Void names (T& s, - EdgeDispatcherBase& d, + EdgeDispatcher& d, Void (X::*pre_) (T&) = (Void (ScopeTemplate<T>::*)(T&)) (0), Void (X::*post_) (T&) = (Void (ScopeTemplate<T>::*)(T&)) (0), Void (X::*none_) (T&) = (Void (ScopeTemplate<T>::*)(T&)) (0), @@ -267,7 +201,7 @@ namespace XSDFrontend } virtual Void - names (T& s, EdgeDispatcherBase& d) + names (T& s, EdgeDispatcher& d) { names<ScopeTemplate<T> > (s, d); } @@ -332,7 +266,7 @@ namespace XSDFrontend pre (Type&); virtual Void - belongs (Type&, EdgeDispatcherBase&); + belongs (Type&, EdgeDispatcher&); virtual Void belongs (Type&); @@ -353,7 +287,7 @@ namespace XSDFrontend pre (Type&); virtual Void - belongs (Type&, EdgeDispatcherBase&); + belongs (Type&, EdgeDispatcher&); virtual Void belongs (Type&); diff --git a/xsd-frontend/traversal/enumeration.cxx b/xsd-frontend/traversal/enumeration.cxx index 4ba10eb..9dfae89 100644 --- a/xsd-frontend/traversal/enumeration.cxx +++ b/xsd-frontend/traversal/enumeration.cxx @@ -38,7 +38,7 @@ namespace XSDFrontend } Void Enumeration:: - inherits (Type& e, EdgeDispatcherBase& d) + inherits (Type& e, EdgeDispatcher& d) { if (e.inherits_p ()) d.dispatch (e.inherits ()); @@ -67,7 +67,7 @@ namespace XSDFrontend } Void Enumerator:: - belongs (Type& e, EdgeDispatcherBase& d) + belongs (Type& e, EdgeDispatcher& d) { d.dispatch (e.belongs ()); } diff --git a/xsd-frontend/traversal/enumeration.hxx b/xsd-frontend/traversal/enumeration.hxx index c1f2b08..f8aeaf7 100644 --- a/xsd-frontend/traversal/enumeration.hxx +++ b/xsd-frontend/traversal/enumeration.hxx @@ -28,7 +28,7 @@ namespace XSDFrontend inherits (Type&); Void - inherits (Type&, EdgeDispatcherBase&); + inherits (Type&, EdgeDispatcher&); virtual Void post (Type&); @@ -43,7 +43,7 @@ namespace XSDFrontend pre (Type&); virtual Void - belongs (Type&, EdgeDispatcherBase&); + belongs (Type&, EdgeDispatcher&); virtual Void belongs (Type&); diff --git a/xsd-frontend/traversal/list.cxx b/xsd-frontend/traversal/list.cxx index 08186a8..523a43c 100644 --- a/xsd-frontend/traversal/list.cxx +++ b/xsd-frontend/traversal/list.cxx @@ -30,7 +30,7 @@ namespace XSDFrontend } Void List:: - argumented (Type& l, EdgeDispatcherBase& d) + argumented (Type& l, EdgeDispatcher& d) { d.dispatch (l.argumented ()); } diff --git a/xsd-frontend/traversal/list.hxx b/xsd-frontend/traversal/list.hxx index d750f17..6105de8 100644 --- a/xsd-frontend/traversal/list.hxx +++ b/xsd-frontend/traversal/list.hxx @@ -25,7 +25,7 @@ namespace XSDFrontend argumented (Type&); virtual Void - argumented (Type&, EdgeDispatcherBase& d); + argumented (Type&, EdgeDispatcher& d); virtual Void name (Type&); diff --git a/xsd-frontend/traversal/union.cxx b/xsd-frontend/traversal/union.cxx index fbee353..26522ec 100644 --- a/xsd-frontend/traversal/union.cxx +++ b/xsd-frontend/traversal/union.cxx @@ -30,7 +30,7 @@ namespace XSDFrontend } Void Union:: - argumented (Type& u, EdgeDispatcherBase& d) + argumented (Type& u, EdgeDispatcher& d) { iterate_and_dispatch (u.argumented_begin (), u.argumented_end (), d); } diff --git a/xsd-frontend/traversal/union.hxx b/xsd-frontend/traversal/union.hxx index dd2b195..fe79929 100644 --- a/xsd-frontend/traversal/union.hxx +++ b/xsd-frontend/traversal/union.hxx @@ -25,7 +25,7 @@ namespace XSDFrontend argumented (Type&); virtual Void - argumented (Type&, EdgeDispatcherBase& d); + argumented (Type&, EdgeDispatcher& d); virtual Void name (Type&); |