Index: /code/branches/hud/CMakeLists.txt
===================================================================
--- /code/branches/hud/CMakeLists.txt (revision 252)
+++ /code/branches/hud/CMakeLists.txt (revision 252)
@@ -0,0 +1,54 @@
+PROJECT(Orxonox)
+
+#set some global variables, which are use throughout the project
+
+#Create some verbose output
+SET(CMAKE_VERBOSE_MAKEFILE TRUE)
+
+#force-set the compile on tardis machines, as default points to g++-3.3
+# only run this test on a lunix/unix machine
+IF (UNIX)
+ FIND_PROGRAM(UNAME_CMD "uname"
+ PATHS "/usr/bin /bin")
+ IF(NOT UNAME_CMD)
+ MESSAGE("Unable to find uname. Tardis-Check cannot be done.")
+ ENDIF(NOT UNAME_CMD)
+ EXECUTE_PROCESS(
+ COMMAND "${UNAME_CMD}" "-n"
+ RESULT_VARIABLE UNAME_RV
+ ERROR_VARIABLE UNAME_EV
+ OUTPUT_VARIABLE UNAME_OV)
+
+ IF (NOT "${UNAME_RV}" STREQUAL "0")
+ MESSAGE("ERROR: uname terminated unclean.")
+ ENDIF (NOT "${UNAME_RV}" STREQUAL "0")
+ # check wheter we are on a tardis machine
+ IF ("${UNAME_OV}" MATCHES "tardis")
+ SET (IS_TARDIS "tardis")
+ ENDIF ("${UNAME_OV}" MATCHES "tardis")
+ # if on tardis change compiler
+ IF (IS_TARDIS)
+ MESSAGE("System is a TARDIS: Setting Compiler to g++-3.4.3")
+ SET(CMAKE_CXX_COMPILER "g++-3.4.3")
+ ENDIF(IS_TARDIS)
+ENDIF (UNIX)
+
+
+#This sets where to look for "Find*.cmake" files
+SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+#Performs the search and sets the variables
+FIND_PACKAGE(OGRE)
+FIND_PACKAGE(OIS)
+FIND_PACKAGE(CEGUI)
+FIND_PACKAGE(CEGUI_OGRE)
+
+#Sets the search paths for the linking
+LINK_DIRECTORIES(${OGRE_LIB_DIR} ${OIS_LIB_DIR} ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR})
+#Sets the search path for include files
+#INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR} -I/usr/include/enet)
+INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR})
+
+#add main source dir
+ADD_SUBDIRECTORY(src)
+
+
Index: /code/branches/hud/INSTALL
===================================================================
--- /code/branches/hud/INSTALL (revision 252)
+++ /code/branches/hud/INSTALL (revision 252)
@@ -0,0 +1,12 @@
+Here our installing directions
+
+requirements:
+ogre-1.4.5
+ois-1.0
+cegui-0.5.0b
+enet-1.0
+
+cmake (used version 2.4.7)
+
+
+Further information about installing and running this application can be found on http://www.orxonox.net/wiki/Running
Index: /code/branches/hud/LICENSE
===================================================================
--- /code/branches/hud/LICENSE (revision 252)
+++ /code/branches/hud/LICENSE (revision 252)
@@ -0,0 +1,344 @@
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, 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 Street, 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.
Index: /code/branches/hud/Media/fonts/read_me.html
===================================================================
--- /code/branches/hud/Media/fonts/read_me.html (revision 252)
+++ /code/branches/hud/Media/fonts/read_me.html (revision 252)
@@ -0,0 +1,2 @@
+Larabie Fonts "read me" file, license and FAQLARABIE FONTS README.TXT
All Larabie Fonts in this file are free to use for personal and/or commercial purposes. No payment is necessary to use these fonts for personal or commercial use. For Software Products who want to include Larabie Fonts see the License Agreement below. You can add this font to a website but do not combine fonts into a single archive or alter them in any way.
All Larabie Fonts are free for commercial use but a sample of your product would be gratefully appreciated so I can see how the font looks in use. Contact www.larabiefonts.com/donation.html for mailing information.
Some Larabie Fonts have enhanced and expanded families available for sale at www.typodermic.com.
If you'd like to make a voluntary donation to Larabie Fonts for the use of the free fonts in any amount please go to www.larabiefonts.com/donation.html
I accept CDs, magazines, t-shirts, a sample of your merchandise or anything featuring Larabie Fonts. Please remember to list your item as a gift on the customs form or I will have to pay import duties and taxes on the item. Mailing information is provided at the link above.
Font installation help is available at www.larabiefonts.com/help.html
LARABIE FONTS FREQUENTLY ASKED QUESTIONS
- Q: How do use these fonts in my favourite software?
- A: In Windows, you take the fonts out of the ZIP archive and place them in your fonts folder which can be found in your Control Panel. The next time you run your software, the font will be available. For example: If you install a new font, the next time you run Microsoft Word, that font will be available in the menu under Format / Font. For anything more complicated, or Mac installation, visit www.larabiefonts.com/help.html
- Q: How can I use this font in AOL Instant Messenger, MSN Messenger, Outlook, Outlook Express, Euodora or any other email software?
- A: At the time of this writing (Feb 2004) you cant. After installing one of my fonts, you may be able to select it in the above applications but the person at the other end wont see that same thing unless they have the font installed. If you really want to use my fonts in these applications, make sure the people at the other end have the same fonts installed.
- Q: How can I use these fonts on a web page?
- A: If youre creating a web page using Flash, its easy. Consult your Flash manual. If youre using Acrobat, make sure the font embedding settings are turned on. Consult your Acrobat manual. For anything else there are limitations: If you want to use one of my fonts as your main, text font youre pretty much out of luck unless you explore a font embedding tool such as WEFT but I dont recommend it. To use my fonts as headings or titles, use image creation software such as The Gimp, Photoshop, Paint Shop Pro, Pixia etc. Save the images as GIF files and place them on your web page. Theres a lot more to it than can be explained here but there are countless books available on web page design.
- Q: How can I make these fonts bigger?
- A: All my fonts are infinitely scalable; the limitations are in your software. A common problem is scaling fonts in Microsoft Word. If you choose Format / Font you can type in any number you like under size.
- Q: Are these fonts really free?
- A: Yes they are. Some fonts such as Neuropol have expanded font families available for sale at www.typodermic.com but the version you downloaded at Larabie Fonts is free.
- Q: Your licence agreement states that the fonts cant be altered. Does that mean I cant mess around with your fonts in Photoshop/Illustrator/Publisher etc?
- A: Those license restrictions refer to altering the actual fonts themselves, not what you make with them. As long as you dont alter the font files in font creation software such as FontLab or Fontographer youre free to create anything you like with them.
- Q: Can I use your fonts in a logo?
- A: Yes. But check with a lawyer if youre not sure. Its okay with me if you use it but do so at your own risk.
- Q: Can you make a custom font for me?
- A: Possibly. Check typodermic.com/custom.html for details. Keep in mind that making fonts is my full-time job so no freebies.
- Q: I want to sell rubber stamp alphabets, alphabet punches or stencil alphabets using your font designs.
- A: Contact me first at www.larabiefonts.com/email.html.
- Q: My software wont let me embed one of your fonts.
- A: You may have an old version of one of my fonts. Uninstall it and install a current version on Larabie Fonts.
- Q: Can you help me find a font?
- A: I really dont have the time but if you send a donation, I can give it a try. If not. post your question on my font forum: www.larabiefonts.com/info.html.
LARABIE FONTS END-USER LICENSE AGREEMENT FOR SOFTWARE PRODUCTS
SOFTWARE PRODUCT LICENSE
The SOFTWARE PRODUCT is protected by copyright laws and International copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
1. GRANT OF LICENSE. This document grants you the following rights:
- Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT. You may copy and distribute unlimited copies of the SOFTWARE PRODUCT as you receive them, in any medium, provided that you publish on each copy an appropriate copyright notice. Keep intact all the notices that refer to this License and give any other recipients of the fonts a copy of this License along with the fonts.
2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
- You may modify your copy or copies of the SOFTWARE PRODUCT or any portion of it, provided that you also meet all of these rules:
a) Do not alter in any way alphanumeric characters (A-Z, a-z, 1-9) contained in the font. An exception is converting between formats, here is allowed the nominal distortion that occurs during conversion from second order to third order quadratic curves (TrueType to Postscript) and vice versa.
b) Extra characters may be added; here it is allowed to use curves (shapes) from alphanumeric characters in fonts under same license.
c) It is allowed to modify and remove analpahbetics (punctuation, special characters, ligatures and symbols).
d) The original font name must be retained but can be augmented. (ie. a Font named Blue Highway can be renamed Blue Highway Cyrillic or Blue Highway ANSI, etc.)
e) Character mapping may be altered.
f) If the kerning information is altered or discarded it must be stated in the user notes or documentation.
g) All modifications must be released under this license.
LIMITED WARRANTY NO WARRANTIES. Larabie Fonts expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or non-infringement. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.NO LIABILITY FOR CONSEQUENTIAL DAMAGES. In no event shall Larabie Fonts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if Larabie Fonts has been advised of the possibility of such damages.
3. MISCELLANEOUS
Should you have any questions concerning this document, or if you desire to contact Larabie Fonts for any reason, please email www.larabiefonts.com/email.html.
+
Index: /code/branches/hud/Media/fonts/sample.fontdef
===================================================================
--- /code/branches/hud/Media/fonts/sample.fontdef (revision 252)
+++ /code/branches/hud/Media/fonts/sample.fontdef (revision 252)
@@ -0,0 +1,11 @@
+StarWars
+{
+ // Now this one I agree with ;)
+ // A Star Wars font :)
+ type truetype
+ source solo5.ttf
+ size 16
+ resolution 96
+}
+
+
Index: /code/branches/hud/Media/gui/CompositorDemo.layout
===================================================================
--- /code/branches/hud/Media/gui/CompositorDemo.layout (revision 252)
+++ /code/branches/hud/Media/gui/CompositorDemo.layout (revision 252)
@@ -0,0 +1,182 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/CompositorDemoCegui.config
===================================================================
--- /code/branches/hud/Media/gui/CompositorDemoCegui.config (revision 252)
+++ /code/branches/hud/Media/gui/CompositorDemoCegui.config (revision 252)
@@ -0,0 +1,6 @@
+
+
Index: /code/branches/hud/Media/gui/CrowdDemo.layout
===================================================================
--- /code/branches/hud/Media/gui/CrowdDemo.layout (revision 252)
+++ /code/branches/hud/Media/gui/CrowdDemo.layout (revision 252)
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/Falagard.xsd
===================================================================
--- /code/branches/hud/Media/gui/Falagard.xsd (revision 252)
+++ /code/branches/hud/Media/gui/Falagard.xsd (revision 252)
@@ -0,0 +1,391 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/Font.xsd
===================================================================
--- /code/branches/hud/Media/gui/Font.xsd (revision 252)
+++ /code/branches/hud/Media/gui/Font.xsd (revision 252)
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/GUILayout.xsd
===================================================================
--- /code/branches/hud/Media/gui/GUILayout.xsd (revision 252)
+++ /code/branches/hud/Media/gui/GUILayout.xsd (revision 252)
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/GUIScheme.xsd
===================================================================
--- /code/branches/hud/Media/gui/GUIScheme.xsd (revision 252)
+++ /code/branches/hud/Media/gui/GUIScheme.xsd (revision 252)
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/Imageset.xsd
===================================================================
--- /code/branches/hud/Media/gui/Imageset.xsd (revision 252)
+++ /code/branches/hud/Media/gui/Imageset.xsd (revision 252)
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/InstancingDemo.layout
===================================================================
--- /code/branches/hud/Media/gui/InstancingDemo.layout (revision 252)
+++ /code/branches/hud/Media/gui/InstancingDemo.layout (revision 252)
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/OceanDemoCegui.config
===================================================================
--- /code/branches/hud/Media/gui/OceanDemoCegui.config (revision 252)
+++ /code/branches/hud/Media/gui/OceanDemoCegui.config (revision 252)
@@ -0,0 +1,6 @@
+
+
Index: /code/branches/hud/Media/gui/OceanDemoLayout.xml
===================================================================
--- /code/branches/hud/Media/gui/OceanDemoLayout.xml (revision 252)
+++ /code/branches/hud/Media/gui/OceanDemoLayout.xml (revision 252)
@@ -0,0 +1,264 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/TaharezLook.imageset
===================================================================
--- /code/branches/hud/Media/gui/TaharezLook.imageset (revision 252)
+++ /code/branches/hud/Media/gui/TaharezLook.imageset (revision 252)
@@ -0,0 +1,242 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/TaharezLook.looknfeel
===================================================================
--- /code/branches/hud/Media/gui/TaharezLook.looknfeel (revision 252)
+++ /code/branches/hud/Media/gui/TaharezLook.looknfeel (revision 252)
@@ -0,0 +1,4315 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/TaharezLookSkin.scheme
===================================================================
--- /code/branches/hud/Media/gui/TaharezLookSkin.scheme (revision 252)
+++ /code/branches/hud/Media/gui/TaharezLookSkin.scheme (revision 252)
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/TaharezLookWidgetAliases.scheme
===================================================================
--- /code/branches/hud/Media/gui/TaharezLookWidgetAliases.scheme (revision 252)
+++ /code/branches/hud/Media/gui/TaharezLookWidgetAliases.scheme (revision 252)
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/bluehighway-10.font
===================================================================
--- /code/branches/hud/Media/gui/bluehighway-10.font (revision 252)
+++ /code/branches/hud/Media/gui/bluehighway-10.font (revision 252)
@@ -0,0 +1,2 @@
+
+
Index: /code/branches/hud/Media/gui/bluehighway-12.font
===================================================================
--- /code/branches/hud/Media/gui/bluehighway-12.font (revision 252)
+++ /code/branches/hud/Media/gui/bluehighway-12.font (revision 252)
@@ -0,0 +1,2 @@
+
+
Index: /code/branches/hud/Media/gui/bluehighway-8.font
===================================================================
--- /code/branches/hud/Media/gui/bluehighway-8.font (revision 252)
+++ /code/branches/hud/Media/gui/bluehighway-8.font (revision 252)
@@ -0,0 +1,2 @@
+
+
Index: /code/branches/hud/Media/gui/cegui8.layout
===================================================================
--- /code/branches/hud/Media/gui/cegui8.layout (revision 252)
+++ /code/branches/hud/Media/gui/cegui8.layout (revision 252)
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/facial.layout
===================================================================
--- /code/branches/hud/Media/gui/facial.layout (revision 252)
+++ /code/branches/hud/Media/gui/facial.layout (revision 252)
@@ -0,0 +1,379 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/ogregui.layout
===================================================================
--- /code/branches/hud/Media/gui/ogregui.layout (revision 252)
+++ /code/branches/hud/Media/gui/ogregui.layout (revision 252)
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/Media/gui/shadows.layout
===================================================================
--- /code/branches/hud/Media/gui/shadows.layout (revision 252)
+++ /code/branches/hud/Media/gui/shadows.layout (revision 252)
@@ -0,0 +1,247 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/README
===================================================================
--- /code/branches/hud/README (revision 252)
+++ /code/branches/hud/README (revision 252)
@@ -0,0 +1,20 @@
+Hi there,
+
+We are proud to present you Orxonox - the most ferious 3D space shooter ever to exist.
+
+This game is free, if you have paid for this, get your money back! The source code of this game is licensed under the GPL (GNU General Public License).
+The game content is licensed under the Creative Commons Attribution-Sharealike 2.5 license. For more information read LICENSE in the same folder you found this file.
+
+For directions to install this game, please check out the file INSTALL or http://www.orxonox.net/wiki/Running
+
+This application uses the Ogre Graphics Engine (http://www.ogre3d.org), if you haven't already downloaded a precompiled version of Ogre with this package. Visit our webpage to get your Orxonox compatible version of the Ogre libraries.
+
+This is an open source game. If you want to contribute check out http://www.orxonox.net/wiki/development to find more information how you could help us making the game better. We are always looking for programmers and content designers, who like to contribute.
+
+We hope you have fun playing the game. Check out http://www.orxonox.net for news and newer versions of the game.
+
+Please contact us in our forum ( http://forum.orxonox.net ) or check out our contact page ( http://www.orxonox.net/wiki/about#Contact ). We hope to hear from you and are looking forward to your feedback.
+
+
+Cheers,
+The Orxonox Development Team
Index: /code/branches/hud/bin/levels/sp_level_moonstation.oxw
===================================================================
--- /code/branches/hud/bin/levels/sp_level_moonstation.oxw (revision 252)
+++ /code/branches/hud/bin/levels/sp_level_moonstation.oxw (revision 252)
@@ -0,0 +1,596 @@
+
+ Moon Station
+ The central moonstation, where the player will 'land'.
+ textures/menu/moonstation_512x512.jpg
+
+
+ textures/load_screens/ambush.png
+ 16
+ 0,0,1.0,1
+ .65,.87,.3,.05
+ textures/load_screens/ambush-loadbar.png
+
+
+ 1, 100000
+
+
+
+
+
+
+ surface
+ -250, 100, -100
+ 1.57, 0, 1, 0
+ models/decoration/moonsurface_1730.obj, 3000
+
+
+
+ Earth
+ textures/planets/earth_no_clouds.jpg
+ 250
+ -1685.414917, 1228.985352, 1216.223511
+ 3.1412, 0,0,1
+
+
+
+ levels/maps/moonstation/moonstation.bsp
+
+
+
+ Sky
+ textures/sky/simple_space
+ 7520
+
+
+
+ Player
+ true
+ models/creatures/doom_male/male.md2, 9
+ 10,10,0,0
+ 630,21,-20
+ group01
+
+
+
+
+
+
+ models/guns/turret/turret_body.obj,10
+ group00
+ ceil
+ true
+ Player
+ 356, 588, -160
+
+ models/guns/turret/turret_riffle.obj,10
+ 0, 47, 0
+
+
+
+ models/guns/turret/turret_radar.obj,10
+ 0, 32.5, 0
+
+
+ 400
+ 10
+ 1
+ false
+ -30,1,11
+ -30,1,-11
+
+
+
+
+ Earth
+ textures/planets/earth_no_clouds.jpg
+ 50
+ 458.725555, 505.465271, -164.975540
+ 3.1412, 0,0,1
+ -0.3
+ 0,1,0
+
+
+
+ Moon
+ textures/planets/pluto.png
+ 10
+ 543.408203, 505.465271, -158.724747
+ 3.1412, 0,0,0
+
+
+
+ zhara
+ models/space_stations/ZHARA_Space_Station.obj, 1
+ models/space_stations/ZHARA_Space_Station.oif
+ 500.981537, 507.057343, -179.489685
+ 3.1412, 0,1,0
+
+
+
+
+
+ models/guns/turret/turret_body.obj,10
+ group00
+ Player
+ -119, 123, 25
+ true
+
+ models/guns/turret/turret_riffle.obj,10
+ 0, 47, 0
+
+
+
+ models/guns/turret/turret_radar.obj,10
+ 0, 32.5, 0
+
+
+ 40000
+ 10
+ 1
+ false
+ -30,1,11
+ -30,1,-11
+
+
+
+
+ door_aircleaning
+ 1
+ 1
+ models/doors/door_small_b.obj, 6.7
+ 3.141, 0, 1, 0
+ 120, 160, 320
+
+
+ 50
+
+
+
+
+ 0.6
+ 0, 0, -45
+ sounds/doors/door_opening2.wav
+ sounds/doors/door_opening2.wav
+
+
+
+
+
+ door_lager
+ 1
+ 1
+ models/doors/door_blue_big.obj, 19
+ 1.57, 0, 1, 0
+ -65, 128, -161.1
+
+
+ 130
+
+
+
+
+ 1.2
+ 0, 92.5, 0
+ sounds/doors/door_opening2.wav
+ sounds/doors/door_opening2.wav
+ sounds/doors/door_closed2.wav
+
+
+
+
+
+ rotor_aircleaning
+ models/decoration/rotor1_hack.obj, 5
+ 52,167,241
+ 0, 0, 0, 0
+ 8,0,0
+
+
+ rotor_aircleaning
+ models/decoration/rotor1_hack.obj, 5
+ 28,167,241
+ 0, 0, 0, 0
+ 8,0,0
+
+
+ rotor_aircleaning
+ models/decoration/rotor1_hack.obj, 5
+ 4,167,241
+ 0, 0, 0, 0
+ 8,0,0
+
+
+ rotor_aircleaning
+ models/decoration/rotor1_hack.obj, 5
+ -20,167,241
+ 0, 0, 0, 0
+ 8,0,0
+
+
+
+
+ models/guns/turret/turret_body.obj,10
+ group00
+ ceil
+ true
+ Player
+ 191, 115, 70
+
+ models/guns/turret/turret_riffle.obj,10
+ 0, 47, 0
+
+
+
+ models/guns/turret/turret_radar.obj,10
+ 0, 32.5, 0
+
+
+ 400
+ 10
+ 1
+ false
+ -30,1,11
+ -30,1,-11
+
+
+
+
+ str3
+ sprite
+ steam01.png
+ 50
+ 4, 6
+ 0.0, 15.0, 20.0
+ 0.2, 20.0, 25.0
+ 1.0, 25.0, 30.0
+ 1.0, 0.3, .2
+ 0,1, 1, 1,.5
+ .5, .6, .6, .6, .2
+ 1, .0, .0, .0, .0
+ 5
+
+
+ SteamEmitter
+ -4.005549, 251.321747, -11.710030
+ 0.927172, -0.003523, -0.374517, 0.008722
+ 0.0, 1
+ 20, 30
+ 8, 15
+ 7
+
+
+
+
+
+ Big one hall
+ sprite
+ steam01.png
+ 50
+ 10, 2
+ 0.0, 100, 100
+ 0.2, 100, 100
+ 1.0, 100, 100
+ 1.0, 0.5, .3
+ 0,1, 1, 1,.5
+ .5, .6, .6, .6, .2
+ 1, .0, .0, .0, .0
+ 5
+
+
+ SteamEmitter
+ 93.780792, -35.366524, 18.198116
+ 3.1412, 0, 0, 1
+ 0, 1.0
+ -50,50
+ 100, 110
+ 2
+
+
+
+
+
+
+ destroyed fighter
+ 540, 30, -100
+ 2.3, 0.9, -2.5, -0.5
+ models/spaceships/human_spaceship_fighter.obj, 8.5
+
+
+
+ str1
+ sprite
+ steam01.png
+ 50
+ 4, 6
+ 0.0, 15.0, 20.0
+ 0.2, 20.0, 25.0
+ 1.0, 25.0, 30.0
+ 1.0, 0.3, .2
+ 0,1, 1, 1,.5
+ .5, .6, .6, .6, .2
+ 1, .0, .0, .0, .0
+ 5
+
+
+ SteamEmitter
+ 727, 93, -111
+ 3.1412, 0, 0, 1
+ 0.0, 1
+ 10, 30
+ 8, 15
+ 7
+
+
+
+
+
+ str2
+ sprite
+ steam01.png
+ 50
+ 4, 6
+ 0.0, 15.0, 20.0
+ 0.2, 20.0, 25.0
+ 1.0, 25.0, 30.0
+ 1.0, 0.3, .2
+ 0,1, 1, 1,.5
+ .5, .6, .6, .6, .2
+ 1, .0, .0, .0, .0
+ 5
+
+
+ SteamEmitter
+ 772, 160, -87.5
+ 3.1412, 0, 0, 1
+ 0.0, 1
+ 10, 30
+ 8, 15
+ 7
+
+
+
+
+
+ Big one
+ sprite
+ steam01.png
+ 50
+ 10, 2
+ 0.0, 100, 100
+ 0.2, 100, 100
+ 1.0, 100, 100
+ 1.0, 0.5, .3
+ 0,1, 1, 1,.5
+ .5, .6, .6, .6, .2
+ 1, .0, .0, .0, .0
+ 5
+
+
+ SteamEmitter
+ 616, -50, -196
+ 3.1412, 0, 0, 1
+ 0, 1.0
+ -50,50
+ 120, 150
+ 6
+
+
+
+
+
+
+
+ door_sleepingroom_l
+ 1
+ 1
+ models/doors/door_small_b.obj, 6.2
+ 1.57, 0, 1, 0
+ 405.5, 160, 175
+
+
+ 50
+
+
+
+
+ 0.6
+ 31, 0, 0
+ sounds/doors/door_opening2.wav
+ sounds/doors/door_opening2.wav
+
+
+
+
+
+ door_sleepingroom_r
+ 1
+ 1
+ models/doors/door_small_b.obj, 6.2
+ 1.57, 0, -1, 0
+ 362, 160, 175
+
+
+ 50
+
+
+
+
+ 0.6
+ -31, 0, 0
+
+
+
+
+
+ Steam in sleeping room
+ sprite
+ steam01.png
+ 50
+ 2, 5
+ 0.0, 15.0, 20.0
+ 0.2, 20.0, 25.0
+ 1.0, 25.0, 30.0
+ 1.0, 0.3, .2
+ 0,1, 1, 1,.5
+ .5, .6, .6, .6, .2
+ 1, .0, .0, .0, .0
+ 5
+
+
+ SteamEmitter
+ 382, 210, 255
+ 3.1412, 0, 0, 1
+ 0.0, 1
+ 10, 30
+ 8, 15
+ 7
+
+
+
+
+
+ Stream Air Cleaning
+ sprite
+ steam01.png
+ 50
+ 10, 0
+ 0.0, 15.0, 2
+ 0.2, 20.0, 5
+ 1.0, 25.0, 7
+ 1.0, 0.3, .2
+ 0,0, 1, 0,.5
+ .5, 0, .6, 0, .2
+ 1, .0, .0, .0, .0
+ 0
+
+
+ SteamEmitter
+ 85, 168, 243
+ 1.57, 0, 0, 1
+ 0.0, 0
+ 20, 2
+ 10, 14
+ 7
+
+
+
+
+
+
+ door_elevator
+ 1
+ 1
+ models/doors/door_small_b.obj, 10
+ 1.57, 0, 1, 0
+ 210, -810, -454
+
+
+ 50
+
+
+
+
+ 0.6
+ 60, 0, 0
+ sounds/doors/door_opening2.wav
+ sounds/doors/door_opening2.wav
+
+
+
+
+
+
+
+
+ IntroSpaceship
+ models/spaceships/human_spaceship_fighter.obj,9
+ models/spaceships/human_spaceship_fighter.oif
+
+
+
+
+ triggeredDoor
+ models/doors/door_blue_big.obj, 19
+ 222, 0, -472
+ 0, 0, 1, 0
+
+
+
+ MoonstationCenterHack
+ models/spaceships/human_spaceship_fighter.obj,0.1
+ 300, 36, -170
+ 3.1412, 0,1,0
+
+
+
+ energyQuest
+ Hangar Door
+ QUEST: Open the door to the hangar.
+ /textures/orxonox_logo.png
+ STORY: I have to leave this station.
+ Maybe I can find a ship in the hangar behind this door.
+ /textures/amiv_braeu.png
+ HINT: Maybe it would be favourably to take a look at the bridge on top of the station.
+
+
+
+ levels/maps/moonstation/moonstation_flares.bsp
+ 1, 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/hud/bin/media.cfg
===================================================================
--- /code/branches/hud/bin/media.cfg (revision 252)
+++ /code/branches/hud/bin/media.cfg (revision 252)
@@ -0,0 +1,16 @@
+Mesh=ogrehead.mesh
+Mesh=geosphere4500.mesh
+Mesh=razor.mesh
+Mesh=knot.mesh
+Mesh=RZR-002.mesh
+Mesh=geosphere8000.mesh
+Mesh=sphere.mesh
+
+CubeMap=cubescene.jpg
+CubeMap=early_morning.jpg
+CubeMap=cubemap.jpg
+CubeMap=morning.jpg
+CubeMap=cloudy_noon.jpg
+CubeMap=evening.jpg
+CubeMap=stormy.jpg
+CubeMap=stevecube.jpg
Index: /code/branches/hud/bin/ogre.cfg-init
===================================================================
--- /code/branches/hud/bin/ogre.cfg-init (revision 252)
+++ /code/branches/hud/bin/ogre.cfg-init (revision 252)
@@ -0,0 +1,7 @@
+Render System=OpenGL Rendering Subsystem
+
+[OpenGL Rendering Subsystem]
+FSAA=4
+Full Screen=No
+RTT Preferred Mode=PBuffer
+Video Mode=1280 x 1024
Index: /code/branches/hud/bin/plugins.cfg-init
===================================================================
--- /code/branches/hud/bin/plugins.cfg-init (revision 252)
+++ /code/branches/hud/bin/plugins.cfg-init (revision 252)
@@ -0,0 +1,14 @@
+# Defines plugins to load
+
+# Define plugin folder
+PluginFolder=/usr/lib/OGRE
+
+# Define plugins
+#Plugin=RenderSystem_Direct3D9
+Plugin=RenderSystem_GL
+Plugin=Plugin_ParticleFX
+Plugin=Plugin_BSPSceneManager
+Plugin=Plugin_OctreeSceneManager
+#Plugin=Plugin_CgProgramManager
+
+
Index: /code/branches/hud/bin/quake3settings.cfg
===================================================================
--- /code/branches/hud/bin/quake3settings.cfg (revision 252)
+++ /code/branches/hud/bin/quake3settings.cfg (revision 252)
@@ -0,0 +1,3 @@
+Pak0Location: f:\quake3levels\chiropteraDM.pk3
+Map: maps/chiropteradm.bsp
+
Index: /code/branches/hud/bin/resources.cfg
===================================================================
--- /code/branches/hud/bin/resources.cfg (revision 252)
+++ /code/branches/hud/bin/resources.cfg (revision 252)
@@ -0,0 +1,23 @@
+# Resource locations to be added to the 'boostrap' path
+# This also contains the minimum you need to use the Ogre example framework
+[Bootstrap]
+Zip=../Media/packs/OgreCore.zip
+
+# Resource locations to be added to the default path
+[General]
+FileSystem=../Media
+FileSystem=../Media/fonts
+#FileSystem=../Media/materials/programs
+#FileSystem=../Media/materials/scripts
+#FileSystem=../Media/materials/textures
+#FileSystem=../Media/models
+#FileSystem=../Media/overlays
+#FileSystem=../Media/particle
+FileSystem=../Media/gui
+#FileSystem=../Media/DeferredShadingMedia
+#Zip=../Media/packs/cubemap.zip
+#Zip=../Media/packs/cubemapsJS.zip
+#Zip=../Media/packs/dragon.zip
+#Zip=../Media/packs/fresneldemo.zip
+#Zip=../Media/packs/ogretestmap.zip
+Zip=../Media/packs/skybox.zip
Index: /code/branches/hud/bin/run-script
===================================================================
--- /code/branches/hud/bin/run-script (revision 252)
+++ /code/branches/hud/bin/run-script (revision 252)
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [[ ! -f main ]] ; then
+ echo "main does not exist"
+ echo "did you compile it?"
+
+ exit 1
+fi
+
+if [[ ! -f orge.cfg ]] ; then
+ cp ogre.cfg-init ogre.cfg
+fi
+
+# check if plugins.cfg exists, and of not create it
+# and modify
+if [[ ! -f plugins.cfg ]] ; then
+ if uname -n | grep "tardis" > /dev/null ; then
+ sed -e 's:PluginFolder=/usr/lib/OGRE:PluginFolder=/usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1/lib/OGRE/:' \
+ -e 's:#Plugin=Plugin_CgProgramManager:Plugin=Plugin_CgProgramManager:' plugins.cfg-init > plugins.cfg
+ else
+ cp plugins.cfg-init plugins.cfg
+ fi
+fi
+exec ./main
Index: /code/branches/hud/bin/run-script.bat
===================================================================
--- /code/branches/hud/bin/run-script.bat (revision 252)
+++ /code/branches/hud/bin/run-script.bat (revision 252)
@@ -0,0 +1,4 @@
+cd ..\..\ogre\Samples\Common\bin\Release
+..\..\..\..\..\trunk\bin\main.exe
+cd ..\..\..\..\..\trunk\bin
+pause
Index: /code/branches/hud/cmake/FindCEGUI.cmake
===================================================================
--- /code/branches/hud/cmake/FindCEGUI.cmake (revision 252)
+++ /code/branches/hud/cmake/FindCEGUI.cmake (revision 252)
@@ -0,0 +1,56 @@
+# Find CEGUI includes and library
+#
+# This module defines
+# CEGUI_INCLUDE_DIR
+# CEGUI_LIBRARIES, the libraries to link against to use CEGUI.
+# CEGUI_LIB_DIR, the location of the libraries
+# CEGUI_FOUND, If false, do not try to use CEGUI
+#
+# Created by Matt Williams to find OGRE libraries
+# Copyright © 2007, Matt Williams
+#
+# Modified by Nicolas Schlumberger to find CEGUI libraries
+# and make it run on the Tardis-Infrastucture of the ETH Zurich
+# Copyright 2007, Nicolas Schlumberger
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+IF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR)
+ SET(CEGUI_FIND_QUIETLY TRUE) # Already in cache, be silent
+ENDIF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR)
+
+IF (WIN32) #Windows
+ MESSAGE(STATUS "Looking for CEGUI")
+ SET(CEGUI_INCLUDE_DIR ../ogre/Dependencies/include/CEGUI)
+ SET(CEGUI_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ogre/Samples/Common/bin/Release/lib)
+ SET(CEGUI_LIBRARIES debug CEGUIBase_d optimized CEGUIBase)
+ELSE (WIN32) #Unix
+ FIND_PACKAGE(PkgConfig)
+ PKG_SEARCH_MODULE(CEGUI CEGUI /usr/pack/cegui-0.5.0-sd/i686-debian-linux3.1/lib/pkgconfig/CEGUI.pc) # tardis specific hack
+ SET(CEGUI_INCLUDE_DIR ${CEGUI_INCLUDE_DIRS})
+ SET(CEGUI_LIB_DIR ${CEGUI_LIBDIR})
+ SET(CEGUI_LIBRARIES ${CEGUI_LIBRARIES} CACHE STRING "")
+ENDIF (WIN32)
+
+#Do some preparation
+SEPARATE_ARGUMENTS(CEGUI_INCLUDE_DIR)
+SEPARATE_ARGUMENTS(CEGUI_LIBRARIES)
+
+SET(CEGUI_INCLUDE_DIR ${CEGUI_INCLUDE_DIR} CACHE PATH "")
+SET(CEGUI_LIBRARIES ${CEGUI_LIBRARIES} CACHE STRING "")
+SET(CEGUI_LIB_DIR ${CEGUI_LIB_DIR} CACHE PATH "")
+
+IF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES)
+ SET(CEGUI_FOUND TRUE)
+ENDIF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES)
+
+IF (CEGUI_FOUND)
+ IF (NOT CEGUI_FIND_QUIETLY)
+ MESSAGE(STATUS " libraries : ${CEGUI_LIBRARIES} from ${CEGUI_LIB_DIR}")
+ MESSAGE(STATUS " includes : ${CEGUI_INCLUDE_DIR}")
+ ENDIF (NOT CEGUI_FIND_QUIETLY)
+ELSE (CEGUI_FOUND)
+ IF (CEGUI_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find CEGUI")
+ ENDIF (CEGUI_FIND_REQUIRED)
+ENDIF (CEGUI_FOUND)
Index: /code/branches/hud/cmake/FindCEGUI_OGRE.cmake
===================================================================
--- /code/branches/hud/cmake/FindCEGUI_OGRE.cmake (revision 252)
+++ /code/branches/hud/cmake/FindCEGUI_OGRE.cmake (revision 252)
@@ -0,0 +1,56 @@
+# Find CEGUI_OGRE includes and library
+#
+# This module defines
+# CEGUI_OGRE_INCLUDE_DIR
+# CEGUI_OGRE_LIBRARIES, the libraries to link against to use CEGUI_OGRE.
+# CEGUI_OGRE_LIB_DIR, the location of the libraries
+# CEGUI_OGRE_FOUND, If false, do not try to use CEGUI_OGRE
+#
+# Created by Matt Williams to find OGRE libraries
+# Copyright © 2007, Matt Williams
+#
+# Modified by Nicolas Schlumberger to find CEGUI-OGRE libraries
+# and make it run on the Tardis-Infrastucture of the ETH Zurich
+# Copyright 2007, Nicolas Schlumberger
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+IF (CEGUI_OGRE_LIBRARIES AND CEGUI_OGRE_INCLUDE_DIR)
+ SET(CEGUI_OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent
+ENDIF (CEGUI_OGRE_LIBRARIES AND CEGUI_OGRE_INCLUDE_DIR)
+
+IF (WIN32) #Windows
+ MESSAGE(STATUS "Looking for CEGUI_OGRE")
+ SET(CEGUI_OGRE_INCLUDE_DIR ../ogre/Samples/Common/CEGUIRenderer/include)
+ SET(CEGUI_OGRE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ogre/Samples/Common/bin/Release/lib)
+ SET(CEGUI_OGRE_LIBRARIES debug OgreGUIRenderer_d optimized OgreGUIRenderer)
+ELSE (WIN32) #Unix
+ FIND_PACKAGE(PkgConfig)
+ PKG_SEARCH_MODULE(CEGUI_OGRE CEGUI-OGRE /usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1/lib/pkgconfig/CEGUI-OGRE.pc) # tardis specific hack
+ SET(CEGUI_OGRE_INCLUDE_DIR ${CEGUI_OGRE_INCLUDE_DIRS})
+ SET(CEGUI_OGRE_LIB_DIR ${CEGUI_OGRE_LIBDIR})
+ SET(CEGUI_OGRE_LIBRARIES ${CEGUI_OGRE_LIBRARIES} CACHE STRING "")
+ENDIF (WIN32)
+
+#Do some preparation
+SEPARATE_ARGUMENTS(CEGUI_OGRE_INCLUDE_DIR)
+SEPARATE_ARGUMENTS(CEGUI_OGRE_LIBRARIES)
+
+SET(CEGUI_OGRE_INCLUDE_DIR ${CEGUI_OGRE_INCLUDE_DIR} CACHE PATH "")
+SET(CEGUI_OGRE_LIBRARIES ${CEGUI_OGRE_LIBRARIES} CACHE STRING "")
+SET(CEGUI_OGRE_LIB_DIR ${CEGUI_OGRE_LIB_DIR} CACHE PATH "")
+
+IF (CEGUI_OGRE_INCLUDE_DIR AND CEGUI_OGRE_LIBRARIES)
+ SET(CEGUI_OGRE_FOUND TRUE)
+ENDIF (CEGUI_OGRE_INCLUDE_DIR AND CEGUI_OGRE_LIBRARIES)
+
+IF (CEGUI_OGRE_FOUND)
+ IF (NOT CEGUI_OGRE_FIND_QUIETLY)
+ MESSAGE(STATUS " libraries : ${CEGUI_OGRE_LIBRARIES} from ${CEGUI_OGRE_LIB_DIR}")
+ MESSAGE(STATUS " includes : ${CEGUI_OGRE_INCLUDE_DIR}")
+ ENDIF (NOT CEGUI_OGRE_FIND_QUIETLY)
+ELSE (CEGUI_OGRE_FOUND)
+ IF (CEGUI_OGRE_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find CEGUI_OGRE")
+ ENDIF (CEGUI_OGRE_FIND_REQUIRED)
+ENDIF (CEGUI_OGRE_FOUND)
Index: /code/branches/hud/cmake/FindOGRE.cmake
===================================================================
--- /code/branches/hud/cmake/FindOGRE.cmake (revision 252)
+++ /code/branches/hud/cmake/FindOGRE.cmake (revision 252)
@@ -0,0 +1,52 @@
+# Find OGRE includes and library
+#
+# This module defines
+# OGRE_INCLUDE_DIR
+# OGRE_LIBRARIES, the libraries to link against to use OGRE.
+# OGRE_LIB_DIR, the location of the libraries
+# OGRE_FOUND, If false, do not try to use OGRE
+#
+# Copyright © 2007, Matt Williams
+# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture of the ETH Zurich
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+IF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR)
+ SET(OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent
+ENDIF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR)
+
+IF (WIN32) #Windows
+ MESSAGE(STATUS "Looking for OGRE")
+ SET(OGRE_INCLUDE_DIR ../ogre/OgreMain/include)
+ SET(OGRE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ogre/Samples/Common/bin/Release)
+ SET(OGRE_LIBRARIES debug OgreMain_d optimized OgreMain)
+ELSE (WIN32) #Unix
+ FIND_PACKAGE(PkgConfig)
+ PKG_SEARCH_MODULE(OGRE OGRE /usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1/lib/pkgconfig/OGRE.pc) # tardis specific hack
+ SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIRS})
+ SET(OGRE_LIB_DIR ${OGRE_LIBDIR})
+ SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
+ENDIF (WIN32)
+
+#Do some preparation
+SEPARATE_ARGUMENTS(OGRE_INCLUDE_DIR)
+SEPARATE_ARGUMENTS(OGRE_LIBRARIES)
+
+SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "")
+SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
+SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "")
+
+IF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES)
+ SET(OGRE_FOUND TRUE)
+ENDIF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES)
+
+IF (OGRE_FOUND)
+ IF (NOT OGRE_FIND_QUIETLY)
+ MESSAGE(STATUS " libraries : ${OGRE_LIBRARIES} from ${OGRE_LIB_DIR}")
+ MESSAGE(STATUS " includes : ${OGRE_INCLUDE_DIR}")
+ ENDIF (NOT OGRE_FIND_QUIETLY)
+ELSE (OGRE_FOUND)
+ IF (OGRE_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find OGRE")
+ ENDIF (OGRE_FIND_REQUIRED)
+ENDIF (OGRE_FOUND)
Index: /code/branches/hud/cmake/FindOIS.cmake
===================================================================
--- /code/branches/hud/cmake/FindOIS.cmake (revision 252)
+++ /code/branches/hud/cmake/FindOIS.cmake (revision 252)
@@ -0,0 +1,56 @@
+# Find OIS includes and library
+#
+# This module defines
+# OIS_INCLUDE_DIR
+# OIS_LIBRARIES, the libraries to link against to use OIS.
+# OIS_LIB_DIR, the location of the libraries
+# OIS_FOUND, If false, do not try to use OIS
+#
+# Created by Matt Williams to find OGRE libraries
+# Copyright © 2007, Matt Williams
+#
+# Modified by Nicolas Schlumberger to find OIS libraries
+# and make it run on the Tardis-Infrastucture of the ETH Zurich
+# Copyright 2007, Nicolas Schlumberger
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+IF (OIS_LIBRARIES AND OIS_INCLUDE_DIR)
+ SET(OIS_FIND_QUIETLY TRUE) # Already in cache, be silent
+ENDIF (OIS_LIBRARIES AND OIS_INCLUDE_DIR)
+
+IF (WIN32) #Windows
+ MESSAGE(STATUS "Looking for OIS")
+ SET(OIS_INCLUDE_DIR ../ogre/Dependencies/include)
+ SET(OIS_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ogre/Samples/Common/bin/Release)
+ SET(OIS_LIBRARIES debug OIS_d optimized OIS)
+ELSE (WIN32) #Unix
+ FIND_PACKAGE(PkgConfig)
+ PKG_SEARCH_MODULE(OIS OIS /usr/pack/ois-1.0-sd/i686-debian-linux3.1/lib/pkgconfig/OIS.pc) # tardis specific hack
+ SET(OIS_INCLUDE_DIR ${OIS_INCLUDE_DIRS})
+ SET(OIS_LIB_DIR ${OIS_LIBDIR})
+ SET(OIS_LIBRARIES ${OIS_LIBRARIES} CACHE STRING "")
+ENDIF (WIN32)
+
+#Do some preparation
+SEPARATE_ARGUMENTS(OIS_INCLUDE_DIR)
+SEPARATE_ARGUMENTS(OIS_LIBRARIES)
+
+SET(OIS_INCLUDE_DIR ${OIS_INCLUDE_DIR} CACHE PATH "")
+SET(OIS_LIBRARIES ${OIS_LIBRARIES} CACHE STRING "")
+SET(OIS_LIB_DIR ${OIS_LIB_DIR} CACHE PATH "")
+
+IF (OIS_INCLUDE_DIR AND OIS_LIBRARIES)
+ SET(OIS_FOUND TRUE)
+ENDIF (OIS_INCLUDE_DIR AND OIS_LIBRARIES)
+
+IF (OIS_FOUND)
+ IF (NOT OIS_FIND_QUIETLY)
+ MESSAGE(STATUS " libraries : ${OIS_LIBRARIES} from ${OIS_LIB_DIR}")
+ MESSAGE(STATUS " includes : ${OIS_INCLUDE_DIR}")
+ ENDIF (NOT OIS_FIND_QUIETLY)
+ELSE (OIS_FOUND)
+ IF (OIS_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find OIS")
+ ENDIF (OIS_FIND_REQUIRED)
+ENDIF (OIS_FOUND)
Index: /code/branches/hud/cmake/FindPkgConfig.cmake
===================================================================
--- /code/branches/hud/cmake/FindPkgConfig.cmake (revision 252)
+++ /code/branches/hud/cmake/FindPkgConfig.cmake (revision 252)
@@ -0,0 +1,360 @@
+# - a pkg-config module for CMake
+#
+# Usage:
+# pkg_check_modules( [REQUIRED] []*)
+# checks for all the given modules
+#
+# pkg_search_module( [REQUIRED] []*)
+# checks for given modules and uses the first working one
+#
+# When the 'REQUIRED' argument was set, macros will fail with an error
+# when module(s) could not be found
+#
+# It sets the following variables:
+# PKG_CONFIG_FOUND ... true iff pkg-config works on the system
+# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
+# _FOUND ... set to 1 iff module(s) exist
+#
+# For the following variables two sets of values exist; first one is the
+# common one and has the given PREFIX. The second set contains flags
+# which are given out when pkgconfig was called with the '--static'
+# option.
+# _LIBRARIES ... only the libraries (w/o the '-l')
+# _LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
+# _LDFLAGS ... all required linker flags
+# _LDFLAGS_OTHERS ... all other linker flags
+# _INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
+# _CFLAGS ... all required cflags
+# _CFLAGS_OTHERS ... the other compiler flags
+#
+# = for common case
+# = _STATIC for static linking
+#
+# There are some special variables whose prefix depends on the count
+# of given modules. When there is only one module, stays
+# unchanged. When there are multiple modules, the prefix will be
+# changed to _:
+# _VERSION ... version of the module
+# _PREFIX ... prefix-directory of the module
+# _INCLUDEDIR ... include-dir of the module
+# _LIBDIR ... lib-dir of the module
+#
+# = when |MODULES| == 1, else
+# = _
+#
+# A parameter can have the following formats:
+# {MODNAME} ... matches any version
+# {MODNAME}>={VERSION} ... at least version is required
+# {MODNAME}={VERSION} ... exactly version is required
+# {MODNAME}<={VERSION} ... modules must not be newer than
+#
+# Examples
+# pkg_check_modules (GLIB2 glib-2.0)
+#
+# pkg_check_modules (GLIB2 glib-2.0>=2.10)
+# requires at least version 2.10 of glib2 and defines e.g.
+# GLIB2_VERSION=2.10.3
+#
+# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
+# requires both glib2 and gtk2, and defines e.g.
+# FOO_glib-2.0_VERSION=2.10.3
+# FOO_gtk+-2.0_VERSION=2.8.20
+#
+# pkg_check_modules (XRENDER REQUIRED xrender)
+# defines e.g.:
+# XRENDER_LIBRARIES=Xrender;X11
+# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
+#
+# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+
+
+# Copyright (C) 2006 Enrico Scholz
+#
+# Redistribution and use, with or without modification, are permitted
+# provided that the following conditions are met:
+#
+# 1. Redistributions must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. The name of the author may not be used to endorse or promote
+# products derived from this software without specific prior
+# written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+### Common stuff ####
+set(PKG_CONFIG_VERSION 1)
+set(PKG_CONFIG_FOUND 0)
+
+find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
+mark_as_advanced(PKG_CONFIG_EXECUTABLE)
+
+if(PKG_CONFIG_EXECUTABLE)
+ set(PKG_CONFIG_FOUND 1)
+endif(PKG_CONFIG_EXECUTABLE)
+
+
+# Unsets the given variables
+macro(_pkgconfig_unset var)
+ set(${var} "" CACHE INTERNAL "")
+endmacro(_pkgconfig_unset)
+
+macro(_pkgconfig_set var value)
+ set(${var} ${value} CACHE INTERNAL "")
+endmacro(_pkgconfig_set)
+
+# Invokes pkgconfig, cleans up the result and sets variables
+macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
+ set(_pkgconfig_invoke_result)
+
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
+ OUTPUT_VARIABLE _pkgconfig_invoke_result
+ RESULT_VARIABLE _pkgconfig_failed)
+
+ if (_pkgconfig_failed)
+ set(_pkgconfig_${_varname} "")
+ _pkgconfig_unset(${_prefix}_${_varname})
+ else(_pkgconfig_failed)
+ string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
+ string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
+
+ if (NOT ${_regexp} STREQUAL "")
+ string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
+ endif(NOT ${_regexp} STREQUAL "")
+
+ separate_arguments(_pkgconfig_invoke_result)
+
+ #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}")
+ set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result})
+ _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}")
+ endif(_pkgconfig_failed)
+endmacro(_pkgconfig_invoke)
+
+# Invokes pkgconfig two times; once without '--static' and once with
+# '--static'
+macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
+ _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN})
+ _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN})
+endmacro(_pkgconfig_invoke_dyn)
+
+# Splits given arguments into options and a package list
+macro(_pkgconfig_parse_options _result _is_req)
+ set(${_is_req} 0)
+
+ foreach(_pkg ${ARGN})
+ if (_pkg STREQUAL "REQUIRED")
+ set(${_is_req} 1)
+ endif (_pkg STREQUAL "REQUIRED")
+ endforeach(_pkg ${ARGN})
+
+ set(${_result} ${ARGN})
+ list(REMOVE_ITEM ${_result} "REQUIRED")
+endmacro(_pkgconfig_parse_options)
+
+###
+macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
+ _pkgconfig_unset(${_prefix}_FOUND)
+ _pkgconfig_unset(${_prefix}_VERSION)
+ _pkgconfig_unset(${_prefix}_PREFIX)
+ _pkgconfig_unset(${_prefix}_INCLUDEDIR)
+ _pkgconfig_unset(${_prefix}_LIBDIR)
+ _pkgconfig_unset(${_prefix}_LIBS)
+ _pkgconfig_unset(${_prefix}_LIBS_L)
+ _pkgconfig_unset(${_prefix}_LIBS_PATHS)
+ _pkgconfig_unset(${_prefix}_LIBS_OTHER)
+ _pkgconfig_unset(${_prefix}_CFLAGS)
+ _pkgconfig_unset(${_prefix}_CFLAGS_I)
+ _pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
+
+ # create a better addressable variable of the modules and calculate its size
+ set(_pkg_check_modules_list ${ARGN})
+ list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
+
+ if(PKG_CONFIG_EXECUTABLE)
+ # give out status message telling checked module
+ if (NOT ${_is_silent})
+ if (_pkg_check_modules_cnt EQUAL 1)
+ message(STATUS "checking for module '${_pkg_check_modules_list}'")
+ else(_pkg_check_modules_cnt EQUAL 1)
+ message(STATUS "checking for modules '${_pkg_check_modules_list}'")
+ endif(_pkg_check_modules_cnt EQUAL 1)
+ endif(NOT ${_is_silent})
+
+ set(_pkg_check_modules_packages)
+ set(_pkg_check_modules_failed)
+
+ # iterate through module list and check whether they exist and match the required version
+ foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
+ set(_pkg_check_modules_exist_query)
+
+ # check whether version is given
+ if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+ string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
+ string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}")
+ string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}")
+ else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+ set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
+ set(_pkg_check_modules_pkg_op)
+ set(_pkg_check_modules_pkg_ver)
+ endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+
+ # handle the operands
+ if (_pkg_check_modules_pkg_op STREQUAL ">=")
+ list(APPEND _pkg_check_modules_exist_query --atleast-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL ">=")
+
+ if (_pkg_check_modules_pkg_op STREQUAL "=")
+ list(APPEND _pkg_check_modules_exist_query --exact-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL "=")
+
+ if (_pkg_check_modules_pkg_op STREQUAL "<=")
+ list(APPEND _pkg_check_modules_exist_query --max-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL "<=")
+
+ # create the final query which is of the format:
+ # * --atleast-version
+ # * --exact-version
+ # * --max-version
+ # * --exists
+ if (_pkg_check_modules_pkg_op)
+ list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
+ else(_pkg_check_modules_pkg_op)
+ list(APPEND _pkg_check_modules_exist_query --exists)
+ endif(_pkg_check_modules_pkg_op)
+
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
+
+ list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
+ list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}")
+
+ # execute the query
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
+ RESULT_VARIABLE _pkgconfig_retval)
+
+ # evaluate result and tell failures
+ if (_pkgconfig_retval)
+ if(NOT ${_is_silent})
+ message(STATUS " package '${_pkg_check_modules_pkg}' not found")
+ endif(NOT ${_is_silent})
+
+ set(_pkg_check_modules_failed 1)
+ endif(_pkgconfig_retval)
+ endforeach(_pkg_check_modules_pkg)
+
+ if(_pkg_check_modules_failed)
+ # fail when requested
+ if (${_is_required})
+ message(SEND_ERROR "A required package was not found")
+ endif (${_is_required})
+ else(_pkg_check_modules_failed)
+ # when we are here, we checked whether requested modules
+ # exist. Now, go through them and set variables
+
+ _pkgconfig_set(${_prefix}_FOUND 1)
+ list(LENGTH _pkg_check_modules_packages pkg_count)
+
+ # iterate through all modules again and set individual variables
+ foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
+ # handle case when there is only one package required
+ if (pkg_count EQUAL 1)
+ set(_pkg_check_prefix "${_prefix}")
+ else(pkg_count EQUAL 1)
+ set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
+ endif(pkg_count EQUAL 1)
+
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
+
+ message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+ endforeach(_pkg_check_modules_pkg)
+
+ # set variables which are combined for multiple modules
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
+
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
+ endif(_pkg_check_modules_failed)
+ else(PKG_CONFIG_EXECUTABLE)
+ if (${_is_required})
+ message(SEND_ERROR "pkg-config tool not found")
+ endif (${_is_required})
+ endif(PKG_CONFIG_EXECUTABLE)
+endmacro(_pkg_check_modules_internal)
+
+###
+### User visible macros start here
+###
+
+###
+macro(pkg_check_modules _prefix _module0)
+ # check cached value
+ if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+ _pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN})
+ _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules})
+
+ _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+endmacro(pkg_check_modules)
+
+###
+macro(pkg_search_module _prefix _module0)
+ # check cached value
+ if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+ set(_pkg_modules_found 0)
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN})
+
+ message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
+
+ # iterate through all modules and stop at the first working one.
+ foreach(_pkg_alt ${_pkg_modules_alt})
+ if(NOT _pkg_modules_found)
+ _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
+ endif(NOT _pkg_modules_found)
+
+ if (${_prefix}_FOUND)
+ set(_pkg_modules_found 1)
+ endif(${_prefix}_FOUND)
+ endforeach(_pkg_alt)
+
+ if (NOT ${_prefix}_FOUND)
+ if(${_pkg_is_required})
+ message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found")
+ endif(${_pkg_is_required})
+ endif(NOT ${_prefix}_FOUND)
+
+ _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+endmacro(pkg_search_module)
+
+### Local Variables:
+### mode: cmake
+### End:
Index: /code/branches/hud/src/CMakeLists.txt
===================================================================
--- /code/branches/hud/src/CMakeLists.txt (revision 252)
+++ /code/branches/hud/src/CMakeLists.txt (revision 252)
@@ -0,0 +1,12 @@
+PROJECT(Orxonox)
+
+# create a few variables to simplify life
+
+SET(SRC_FILES orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc)
+SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h)
+
+#Creates an executable
+ADD_EXECUTABLE(../bin/main ${SRC_FILES} ${INC_FILES})
+#Links the executable against OGRE and OIS
+TARGET_LINK_LIBRARIES(../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${CEGUI_LIBRARIES} ${CEGUI_OGRE_LIBRARIES})
+
Index: /code/branches/hud/src/loader/LevelLoader.cc
===================================================================
--- /code/branches/hud/src/loader/LevelLoader.cc (revision 252)
+++ /code/branches/hud/src/loader/LevelLoader.cc (revision 252)
@@ -0,0 +1,133 @@
+#include
+#include
+
+#include "LevelLoader.h"
+#include "../xml/xmlParser.h"
+
+using namespace std;
+
+namespace loader
+{
+
+LevelLoader::LevelLoader(string file, string dir)
+{
+ // Load XML level file
+ dir.append("/");
+ dir.append(file);
+ rootNode = XMLNode::openFileHelper(dir.c_str(),"WorldDataFile");
+ // TODO: Error handling
+
+ // Assing general level infos to class variables
+ this->name_ = rootNode.getChildNode("name").getText();
+ this->description_ = rootNode.getChildNode("description").getText();
+ this->image_ = rootNode.getChildNode("image").getText();
+
+ this->loadingScreen();
+
+ // Assign sub-nodes
+ if (rootNode.nChildNode("LightManager")==1)
+ {
+ // Init Luightmanager...
+ }
+
+ /*
+
+ worldNode = rootNode.getChildNode("WorldEntities");
+ scriptNode = rootNode.getChildNode("ScriptManager");
+ cameraNode = rootNode.getChildNode("CameraMan");
+ lightNode = rootNode.getChildNode("LightManager");
+*/
+
+}
+
+LevelLoader::~LevelLoader()
+{
+
+
+}
+
+
+string LevelLoader::name()
+{
+ return this->name_;
+}
+
+string LevelLoader::description()
+{
+ return this->description_;
+}
+
+string LevelLoader::image()
+{
+ return this->image_;
+}
+
+void LevelLoader::loadingScreen()
+{
+ cout << "\n\n\nThis is Orxonox\nthe hottest 3D action shooter ever to exist\n\n\n";
+ cout << "Level: " << name() << "\nDescription:" << description() << "\nImage:"<addLight(diffuse,coor);
+ }
+ }
+ lm->setAmbient(lightNode.getChildNode("ambient").getAttribute("color"));
+}
+
+void LevelLoader::loadCameras(CameraManager* cm)
+{
+ if (!cameraNode.getChildNode("cameras").isEmpty())
+ {
+ int nCameras = cameraNode.getChildNode("cameras").nChildNode("camera");
+ for (int i=0; iaddCamera();
+ }
+ }
+}
+
+
+void LevelLoader::loadScripts(ScriptManager* sm)
+{
+ if (!scriptNode.getChildNode("scripts").isEmpty())
+ {
+ int nScripts = scriptNode.getChildNode("scripts").nChildNode("script");
+ for (int i=0; iaddScript(t.getAttribute("file"));
+ }
+
+ }
+}
+*/
+
+
+}
+
Index: /code/branches/hud/src/loader/LevelLoader.h
===================================================================
--- /code/branches/hud/src/loader/LevelLoader.h (revision 252)
+++ /code/branches/hud/src/loader/LevelLoader.h (revision 252)
@@ -0,0 +1,54 @@
+/**
+* Orxonox - www.orxonox.net
+* Level Loader class
+*
+* @author Nicolas Perrenoud
+*/
+
+#include
+#include
+
+#include "../xml/xmlParser.h"
+
+#ifndef __MODULE_LEVELLOADER__
+#define __MODULE_LEVELLOADER__
+
+using namespace std;
+
+namespace loader
+{
+ class LevelLoader
+ {
+ private:
+
+ // XML Nodes
+ XMLNode rootNode;
+ XMLNode worldNode;
+ XMLNode scriptNode;
+ XMLNode cameraNode;
+ XMLNode lightNode;
+
+ // Level information
+ string name_;
+ string description_;
+ string image_;
+
+ public:
+
+ // Constructors
+ LevelLoader(string file, string dir="levels");
+ ~LevelLoader();
+
+ void loadingScreen();
+
+ // Getters
+ string name();
+ string description();
+ string image();
+
+ // Managers
+
+
+ };
+}
+#endif
Index: /code/branches/hud/src/loader/Light.cc
===================================================================
--- /code/branches/hud/src/loader/Light.cc (revision 252)
+++ /code/branches/hud/src/loader/Light.cc (revision 252)
@@ -0,0 +1,23 @@
+
+#include "../xml/xmlParser.h"
+#include "Light.h"
+
+namespace light
+{
+ Light::Light()
+ {
+
+ }
+
+ Light::Light(XMLNode xml)
+ {
+ this->loadParams(xml);
+ }
+
+ void Light::loadParams(XMLNode xml)
+ {
+ // Here comes the tricky part... convert strings to int
+ const char* diffuse = xml.getAttribute("diffuse-color");
+ const char* coor = xml.getAttribute("abs-coor");
+ }
+}
Index: /code/branches/hud/src/loader/Light.h
===================================================================
--- /code/branches/hud/src/loader/Light.h (revision 252)
+++ /code/branches/hud/src/loader/Light.h (revision 252)
@@ -0,0 +1,28 @@
+
+#include "../xml/xmlParser.h"
+
+#ifndef __MODULE_LIGHT__
+#define __MODULE_LIGHT__
+
+namespace light
+{
+ class Light()
+ {
+ public:
+ Light();
+ Light(XMLNode xml);
+ ~Light();
+ void loadParams(XMLNode xml);
+
+ private:
+ float diffuseColor_r_;
+ float diffuseColor_g_;
+ float diffuseColor_b_;
+
+ int coord_x_;
+ int coord_y_;
+ int coord_z_;
+ };
+}
+
+#endif
Index: /code/branches/hud/src/loader/LightManager.cc
===================================================================
--- /code/branches/hud/src/loader/LightManager.cc (revision 252)
+++ /code/branches/hud/src/loader/LightManager.cc (revision 252)
@@ -0,0 +1,28 @@
+
+#include "../xml/xmlParser.h"
+#include "LightManager.h"
+
+namespace light
+{
+ LightManager::LightManager()
+ {
+ vector this->elements_ = new vector;
+ }
+
+ void LightManager::loadParams(XMLNode xml)
+ {
+ if (!xml.isEmpty())
+ {
+ int nLights = xml.nChildNode("light");
+ for (int i=0; ielements_.append(l);
+ }
+ }
+
+ }
+
+
+}
+
Index: /code/branches/hud/src/loader/LightManager.h
===================================================================
--- /code/branches/hud/src/loader/LightManager.h (revision 252)
+++ /code/branches/hud/src/loader/LightManager.h (revision 252)
@@ -0,0 +1,26 @@
+#include
+
+#include "../xml/xmlParser.h"
+#include "Light.h"
+
+#ifndef __MODULE_LIGHTMANAGER__
+#define __MODULE_LIGHTMANAGER__
+
+namespace light
+{
+ class LightManager()
+ {
+ public:
+ LightManager();
+ ~LightManager();
+ void loadParams(XMLNode xml);
+
+ private:
+ float ambient_r_;
+ float ambient_g_;
+ float ambient_b_;
+ vector elements_;
+ };
+}
+
+#endif
Index: /code/branches/hud/src/orxonox.cc
===================================================================
--- /code/branches/hud/src/orxonox.cc (revision 252)
+++ /code/branches/hud/src/orxonox.cc (revision 252)
@@ -0,0 +1,277 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * 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 3 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, see .
+ *
+ *
+ * Author:
+ * Benjamin Knecht , (C) 2007
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file orxonox.cc
+ @brief Orxonox Main File
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "xml/xmlParser.h"
+#include "loader/LevelLoader.h"
+
+
+// some tests to see if enet works without includsion
+//#include
+//#include
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#include
+
+// This function will locate the path to our application on OS X,
+// unlike windows you can not rely on the curent working directory
+// for locating your configuration files and resources.
+std::string macBundlePath()
+{
+ char path[1024];
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+ assert(mainBundle);
+
+ CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
+ assert(mainBundleURL);
+
+ CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
+ assert(cfStringRef);
+
+ CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
+
+ CFRelease(mainBundleURL);
+ CFRelease(cfStringRef);
+
+ return std::string(path);
+}
+#endif
+
+using namespace Ogre;
+
+class OrxExitListener : public FrameListener
+{
+ public:
+ OrxExitListener(OIS::Keyboard *keyboard)
+ : mKeyboard(keyboard)
+ {
+ }
+
+ bool frameStarted(const FrameEvent& evt)
+ {
+ mKeyboard->capture();
+ return !mKeyboard->isKeyDown(OIS::KC_ESCAPE);
+ }
+
+ private:
+ OIS::Keyboard *mKeyboard;
+};
+
+class OrxApplication
+{
+ public:
+ void go()
+ {
+ createRoot();
+ defineResources();
+ setupRenderSystem();
+ createRenderWindow();
+ initializeResourceGroups();
+ createScene();
+ setupScene();
+ setupInputSystem();
+ setupCEGUI();
+ createFrameListener();
+ startRenderLoop();
+ }
+
+ ~OrxApplication()
+ {
+ mInputManager->destroyInputObject(mKeyboard);
+ OIS::InputManager::destroyInputSystem(mInputManager);
+
+// delete mRenderer;
+// delete mSystem;
+
+ delete mListener;
+ delete mRoot;
+ }
+
+ private:
+ Root *mRoot;
+ OIS::Keyboard *mKeyboard;
+ OIS::Mouse *mMouse;
+ OIS::InputManager *mInputManager;
+ CEGUI::OgreCEGUIRenderer *mRenderer;
+ CEGUI::System *mSystem;
+ OrxExitListener *mListener;
+
+ void createRoot()
+ {
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ mRoot = new Root(macBundlePath() + "/Contents/Resources/plugins.cfg");
+#else
+ mRoot = new Root();
+#endif
+ }
+
+ void defineResources()
+ {
+ String secName, typeName, archName;
+ ConfigFile cf;
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
+#else
+ cf.load("resources.cfg");
+#endif
+
+ ConfigFile::SectionIterator seci = cf.getSectionIterator();
+ while (seci.hasMoreElements())
+ {
+ secName = seci.peekNextKey();
+ ConfigFile::SettingsMultiMap *settings = seci.getNext();
+ ConfigFile::SettingsMultiMap::iterator i;
+ for (i = settings->begin(); i != settings->end(); ++i)
+ {
+ typeName = i->first;
+ archName = i->second;
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName);
+#else
+ ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName);
+#endif
+ }
+ }
+ }
+
+ void setupRenderSystem()
+ {
+ if (!mRoot->restoreConfig() && !mRoot->showConfigDialog())
+ throw Exception(52, "User canceled the config dialog!", "OrxApplication::setupRenderSystem()");
+ }
+
+ void createRenderWindow()
+ {
+ mRoot->initialise(true, "Ogre Render Window");
+ }
+
+ void initializeResourceGroups()
+ {
+ TextureManager::getSingleton().setDefaultNumMipmaps(5);
+ ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+ }
+
+ void createScene(void)
+ {
+
+ string levelFile = "sp_level_moonstation.oxw";
+ loader::LevelLoader* loader = new loader::LevelLoader(levelFile);
+ }
+
+ void setupScene()
+ {
+ SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
+ Camera *cam = mgr->createCamera("Camera");
+ Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
+ }
+
+ void setupInputSystem()
+ {
+ size_t windowHnd = 0;
+ std::ostringstream windowHndStr;
+ OIS::ParamList pl;
+ RenderWindow *win = mRoot->getAutoCreatedWindow();
+
+ win->getCustomAttribute("WINDOW", &windowHnd);
+ windowHndStr << windowHnd;
+ pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+ mInputManager = OIS::InputManager::createInputSystem(pl);
+
+ try
+ {
+ mKeyboard = static_cast(mInputManager->createInputObject(OIS::OISKeyboard, false));
+ mMouse = static_cast(mInputManager->createInputObject(OIS::OISMouse, false));
+ }
+ catch (const OIS::Exception &e)
+ {
+ throw new Exception(42, e.eText, "OrxApplication::setupInputSystem");
+ }
+ }
+
+ void setupCEGUI()
+ {
+ SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
+ RenderWindow *win = mRoot->getAutoCreatedWindow();
+
+ // CEGUI setup
+// mRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mgr);
+// mSystem = new CEGUI::System(mRenderer);
+
+ // Other CEGUI setup here.
+ }
+
+ void createFrameListener()
+ {
+ mListener = new OrxExitListener(mKeyboard);
+ mRoot->addFrameListener(mListener);
+ }
+
+ void startRenderLoop()
+ {
+ mRoot->startRendering();
+ }
+};
+
+#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+
+ INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+#else
+ int main(int argc, char **argv)
+#endif
+{
+ try
+ {
+ OrxApplication orxonox;
+ orxonox.go();
+ }
+ catch(Exception& e)
+ {
+#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+ MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+#else
+ fprintf(stderr, "An exception has occurred: %s\n",
+ e.getFullDescription().c_str());
+#endif
+ }
+
+ return 0;
+}
+
Index: /code/branches/hud/src/xml/xmlParser.cc
===================================================================
--- /code/branches/hud/src/xml/xmlParser.cc (revision 252)
+++ /code/branches/hud/src/xml/xmlParser.cc (revision 252)
@@ -0,0 +1,2721 @@
+/**
+ ****************************************************************************
+ * XML.c - implementation file for basic XML parser written in ANSI C++
+ * for portability. It works by using recursion and a node tree for breaking
+ * down the elements of an XML document.
+ *
+ * @version V2.33
+ * @author Frank Vanden Berghen
+ *
+ * NOTE:
+ *
+ * If you add "#define STRICT_PARSING", on the first line of this file
+ * the parser will see the following XML-stream:
+ * some textother text
+ * as an error. Otherwise, this tring will be equivalent to:
+ * some textother text
+ *
+ * NOTE:
+ *
+ * If you add "#define APPROXIMATE_PARSING" on the first line of this file
+ * the parser will see the following XML-stream:
+ *
+ *
+ *
+ * as equivalent to the following XML-stream:
+ *
+ *
+ *
+ * This can be useful for badly-formed XML-streams but prevent the use
+ * of the following XML-stream (problem is: tags at contiguous levels
+ * have the same names):
+ *
+ *
+ *
+ *
+ *
+ *
+ * NOTE:
+ *
+ * If you add "#define _XMLPARSER_NO_MESSAGEBOX_" on the first line of this file
+ * the "openFileHelper" function will always display error messages inside the
+ * console instead of inside a message-box-window. Message-box-windows are
+ * available on windows 9x/NT/2000/XP/Vista only.
+ *
+ * BSD license:
+ * Copyright (c) 2002, Frank Vanden Berghen
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Frank Vanden Berghen nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ */
+#ifndef _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+#include "xmlParser.h"
+#ifdef _XMLWINDOWS
+//#ifdef _DEBUG
+//#define _CRTDBG_MAP_ALLOC
+//#include
+//#endif
+#define WIN32_LEAN_AND_MEAN
+#include // to have IsTextUnicode, MultiByteToWideChar, WideCharToMultiByte to handle unicode files
+ // to have "MessageBoxA" to display error messages for openFilHelper
+#endif
+
+#include
+#include
+#include
+#include
+#include
+
+XMLCSTR XMLNode::getVersion() { return _X("v2.30"); }
+void freeXMLString(XMLSTR t){free(t);}
+
+static XMLNode::XMLCharEncoding characterEncoding=XMLNode::encoding_UTF8;
+static char guessWideCharChars=1, dropWhiteSpace=1;
+
+inline int mmin( const int t1, const int t2 ) { return t1 < t2 ? t1 : t2; }
+
+// You can modify the initialization of the variable "XMLClearTags" below
+// to change the clearTags that are currently recognized by the library.
+// The number on the second columns is the length of the string inside the
+// first column. The "") },
+ { _X("") },
+ { _X("") ,5, _X("
") },
+ { _X("")},
+ { _X("") },
+ { NULL ,0, NULL }
+};
+
+// You can modify the initialization of the variable "XMLEntities" below
+// to change the character entities that are currently recognized by the library.
+// The number on the second columns is the length of the string inside the
+// first column. Additionally, the syntaxes " " and " " are recognized.
+typedef struct { XMLCSTR s; int l; XMLCHAR c;} XMLCharacterEntity;
+static XMLCharacterEntity XMLEntities[] =
+{
+ { _X("&" ), 5, _X('&' )},
+ { _X("<" ), 4, _X('<' )},
+ { _X(">" ), 4, _X('>' )},
+ { _X("""), 6, _X('\"')},
+ { _X("'"), 6, _X('\'')},
+ { NULL , 0, '\0' }
+};
+
+// When rendering the XMLNode to a string (using the "createXMLString" function),
+// you can ask for a beautiful formatting. This formatting is using the
+// following indentation character:
+#define INDENTCHAR _X('\t')
+
+// The following function parses the XML errors into a user friendly string.
+// You can edit this to change the output language of the library to something else.
+XMLCSTR XMLNode::getError(XMLError xerror)
+{
+ switch (xerror)
+ {
+ case eXMLErrorNone: return _X("No error");
+ case eXMLErrorMissingEndTag: return _X("Warning: Unmatched end tag");
+ case eXMLErrorNoXMLTagFound: return _X("Warning: No XML tag found");
+ case eXMLErrorEmpty: return _X("Error: No XML data");
+ case eXMLErrorMissingTagName: return _X("Error: Missing start tag name");
+ case eXMLErrorMissingEndTagName: return _X("Error: Missing end tag name");
+ case eXMLErrorUnmatchedEndTag: return _X("Error: Unmatched end tag");
+ case eXMLErrorUnmatchedEndClearTag: return _X("Error: Unmatched clear tag end");
+ case eXMLErrorUnexpectedToken: return _X("Error: Unexpected token found");
+ case eXMLErrorNoElements: return _X("Error: No elements found");
+ case eXMLErrorFileNotFound: return _X("Error: File not found");
+ case eXMLErrorFirstTagNotFound: return _X("Error: First Tag not found");
+ case eXMLErrorUnknownCharacterEntity:return _X("Error: Unknown character entity");
+ case eXMLErrorCharConversionError: return _X("Error: unable to convert between WideChar and MultiByte chars");
+ case eXMLErrorCannotOpenWriteFile: return _X("Error: unable to open file for writing");
+ case eXMLErrorCannotWriteFile: return _X("Error: cannot write into file");
+
+ case eXMLErrorBase64DataSizeIsNotMultipleOf4: return _X("Warning: Base64-string length is not a multiple of 4");
+ case eXMLErrorBase64DecodeTruncatedData: return _X("Warning: Base64-string is truncated");
+ case eXMLErrorBase64DecodeIllegalCharacter: return _X("Error: Base64-string contains an illegal character");
+ case eXMLErrorBase64DecodeBufferTooSmall: return _X("Error: Base64 decode output buffer is too small");
+ };
+ return _X("Unknown");
+}
+
+/////////////////////////////////////////////////////////////////////////
+// Here start the abstraction layer to be OS-independent //
+/////////////////////////////////////////////////////////////////////////
+
+// Here is an abstraction layer to access some common string manipulation functions.
+// The abstraction layer is currently working for gcc, Microsoft Visual Studio 6.0,
+// Microsoft Visual Studio .NET, CC (sun compiler) and Borland C++.
+// If you plan to "port" the library to a new system/compiler, all you have to do is
+// to edit the following lines.
+#ifdef XML_NO_WIDE_CHAR
+char myIsTextWideChar(const void *b, int len) { return FALSE; }
+#else
+ #if defined (UNDER_CE) || !defined(_XMLWINDOWS)
+ char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIsTextUnicode
+ {
+#ifdef sun
+ // for SPARC processors: wchar_t* buffers must always be alligned, otherwise it's a char* buffer.
+ if ((((unsigned long)b)%sizeof(wchar_t))!=0) return FALSE;
+#endif
+ const wchar_t *s=(const wchar_t*)b;
+
+ // buffer too small:
+ if (len<(int)sizeof(wchar_t)) return FALSE;
+
+ // odd length test
+ if (len&1) return FALSE;
+
+ /* only checks the first 256 characters */
+ len=mmin(256,len/sizeof(wchar_t));
+
+ // Check for the special byte order:
+ if (*((unsigned short*)s) == 0xFFFE) return TRUE; // IS_TEXT_UNICODE_REVERSE_SIGNATURE;
+ if (*((unsigned short*)s) == 0xFEFF) return TRUE; // IS_TEXT_UNICODE_SIGNATURE
+
+ // checks for ASCII characters in the UNICODE stream
+ int i,stats=0;
+ for (i=0; ilen/2) return TRUE;
+
+ // Check for UNICODE NULL chars
+ for (i=0; i
+ static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return wsncasecmp(c1,c2,l);}
+ static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wsncmp(c1,c2,l);}
+ static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return wscasecmp(c1,c2); }
+ #else
+ // for gcc
+ static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncasecmp(c1,c2,l);}
+ static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncmp(c1,c2,l);}
+ static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return wcscasecmp(c1,c2); }
+ #endif
+ static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)wcsstr(c1,c2); }
+ static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)wcscpy(c1,c2); }
+ static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode)
+ {
+ char *filenameAscii=myWideCharToMultiByte(filename);
+ FILE *f;
+ if (mode[0]==_X('r')) f=fopen(filenameAscii,"rb");
+ else f=fopen(filenameAscii,"wb");
+ free(filenameAscii);
+ return f;
+ }
+ #else
+ static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode) { return fopen(filename,mode); }
+ static inline int xstrlen(XMLCSTR c) { return strlen(c); }
+ static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncasecmp(c1,c2,l);}
+ static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncmp(c1,c2,l);}
+ static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return strcasecmp(c1,c2); }
+ static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)strstr(c1,c2); }
+ static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)strcpy(c1,c2); }
+ #endif
+ static inline int _strnicmp(const char *c1,const char *c2, int l) { return strncasecmp(c1,c2,l);}
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+// the "openFileHelper" function //
+/////////////////////////////////////////////////////////////////////////
+
+// Since each application has its own way to report and deal with errors, you should modify & rewrite
+// the following "openFileHelper" function to get an "error reporting mechanism" tailored to your needs.
+XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag)
+{
+ // guess the value of the global parameter "characterEncoding"
+ // (the guess is based on the first 200 bytes of the file).
+ FILE *f=xfopen(filename,_X("rb"));
+ if (f)
+ {
+ char bb[205];
+ int l=(int)fread(bb,1,200,f);
+ setGlobalOptions(guessCharEncoding(bb,l),guessWideCharChars,dropWhiteSpace);
+ fclose(f);
+ }
+
+ // parse the file
+ XMLResults pResults;
+ XMLNode xnode=XMLNode::parseFile(filename,tag,&pResults);
+
+ // display error message (if any)
+ if (pResults.error != eXMLErrorNone)
+ {
+ // create message
+ char message[2000],*s1=(char*)"",*s3=(char*)""; XMLCSTR s2=_X("");
+ if (pResults.error==eXMLErrorFirstTagNotFound) { s1=(char*)"First Tag should be '"; s2=tag; s3=(char*)"'.\n"; }
+ sprintf(message,
+#ifdef _XMLWIDECHAR
+ "XML Parsing error inside file '%S'.\n%S\nAt line %i, column %i.\n%s%S%s"
+#else
+ "XML Parsing error inside file '%s'.\n%s\nAt line %i, column %i.\n%s%s%s"
+#endif
+ ,filename,XMLNode::getError(pResults.error),pResults.nLine,pResults.nColumn,s1,s2,s3);
+
+ // display message
+#if defined(_XMLWINDOWS) && !defined(UNDER_CE) && !defined(_XMLPARSER_NO_MESSAGEBOX_)
+ MessageBoxA(NULL,message,"XML Parsing error",MB_OK|MB_ICONERROR|MB_TOPMOST);
+#else
+ printf("%s",message);
+#endif
+ exit(255);
+ }
+ return xnode;
+}
+
+/////////////////////////////////////////////////////////////////////////
+// Here start the core implementation of the XMLParser library //
+/////////////////////////////////////////////////////////////////////////
+
+// You should normally not change anything below this point.
+
+#ifndef _XMLWIDECHAR
+// If "characterEncoding=ascii" then we assume that all characters have the same length of 1 byte.
+// If "characterEncoding=UTF8" then the characters have different lengths (from 1 byte to 4 bytes).
+// If "characterEncoding=ShiftJIS" then the characters have different lengths (from 1 byte to 2 bytes).
+// This table is used as lookup-table to know the length of a character (in byte) based on the
+// content of the first byte of the character.
+// (note: if you modify this, you must always have XML_utf8ByteTable[0]=0 ).
+static const char XML_utf8ByteTable[256] =
+{
+ // 0 1 2 3 4 5 6 7 8 9 a b c d e f
+ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x00
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x10
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x20
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x30
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x40
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x50
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x60
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x70End of ASCII range
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x80 0x80 to 0xc1 invalid
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x90
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xa0
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xb0
+ 1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xc0 0xc2 to 0xdf 2 byte
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xd0
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,// 0xe0 0xe0 to 0xef 3 byte
+ 4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
+};
+static const char XML_asciiByteTable[256] =
+{
+ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+};
+static const char XML_sjisByteTable[256] =
+{
+ // 0 1 2 3 4 5 6 7 8 9 a b c d e f
+ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x00
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x10
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x20
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x30
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x40
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x50
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x60
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x70 End of ASCII range
+ 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0x80 0x81 to 0x9F 2 bytes
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0x90
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xa0
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xb0
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xc0
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xd0
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xe0 0xe0 to 0xef 2 bytes
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 // 0xf0
+};
+static const char *XML_ByteTable=(const char *)XML_utf8ByteTable; // the default is "characterEncoding=XMLNode::encoding_UTF8"
+#endif
+
+
+XMLNode XMLNode::emptyXMLNode;
+XMLClear XMLNode::emptyXMLClear={ NULL, NULL, NULL};
+XMLAttribute XMLNode::emptyXMLAttribute={ NULL, NULL};
+
+// Enumeration used to decipher what type a token is
+typedef enum XMLTokenTypeTag
+{
+ eTokenText = 0,
+ eTokenQuotedText,
+ eTokenTagStart, /* "<" */
+ eTokenTagEnd, /* "" */
+ eTokenCloseTag, /* ">" */
+ eTokenEquals, /* "=" */
+ eTokenDeclaration, /* "" */
+ eTokenShortHandClose, /* "/>" */
+ eTokenClear,
+ eTokenError
+} XMLTokenType;
+
+// Main structure used for parsing XML
+typedef struct XML
+{
+ XMLCSTR lpXML;
+ XMLCSTR lpszText;
+ int nIndex,nIndexMissigEndTag;
+ enum XMLError error;
+ XMLCSTR lpEndTag;
+ int cbEndTag;
+ XMLCSTR lpNewElement;
+ int cbNewElement;
+ int nFirst;
+} XML;
+
+typedef struct
+{
+ ALLXMLClearTag *pClr;
+ XMLCSTR pStr;
+} NextToken;
+
+// Enumeration used when parsing attributes
+typedef enum Attrib
+{
+ eAttribName = 0,
+ eAttribEquals,
+ eAttribValue
+} Attrib;
+
+// Enumeration used when parsing elements to dictate whether we are currently
+// inside a tag
+typedef enum Status
+{
+ eInsideTag = 0,
+ eOutsideTag
+} Status;
+
+XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nFormat) const
+{
+ if (!d) return eXMLErrorNone;
+ FILE *f=xfopen(filename,_X("wb"));
+ if (!f) return eXMLErrorCannotOpenWriteFile;
+#ifdef _XMLWIDECHAR
+ unsigned char h[2]={ 0xFF, 0xFE };
+ if (!fwrite(h,2,1,f)) return eXMLErrorCannotWriteFile;
+ if ((!isDeclaration())&&((d->lpszName)||(!getChildNode().isDeclaration())))
+ {
+ if (!fwrite(_X("\n"),sizeof(wchar_t)*40,1,f))
+ return eXMLErrorCannotWriteFile;
+ }
+#else
+ if ((!isDeclaration())&&((d->lpszName)||(!getChildNode().isDeclaration())))
+ {
+ if (characterEncoding==encoding_UTF8)
+ {
+ // header so that windows recognize the file as UTF-8:
+ unsigned char h[3]={0xEF,0xBB,0xBF}; if (!fwrite(h,3,1,f)) return eXMLErrorCannotWriteFile;
+ encoding="utf-8";
+ } else if (characterEncoding==encoding_ShiftJIS) encoding="SHIFT-JIS";
+
+ if (!encoding) encoding="ISO-8859-1";
+ if (fprintf(f,"\n",encoding)<0) return eXMLErrorCannotWriteFile;
+ } else
+ {
+ if (characterEncoding==encoding_UTF8)
+ {
+ unsigned char h[3]={0xEF,0xBB,0xBF}; if (!fwrite(h,3,1,f)) return eXMLErrorCannotWriteFile;
+ }
+ }
+#endif
+ int i;
+ XMLSTR t=createXMLString(nFormat,&i);
+ if (!fwrite(t,sizeof(XMLCHAR)*i,1,f)) return eXMLErrorCannotWriteFile;
+ if (fclose(f)!=0) return eXMLErrorCannotWriteFile;
+ free(t);
+ return eXMLErrorNone;
+}
+
+// Duplicate a given string.
+XMLSTR stringDup(XMLCSTR lpszData, int cbData)
+{
+ if (lpszData==NULL) return NULL;
+
+ XMLSTR lpszNew;
+ if (cbData==0) cbData=(int)xstrlen(lpszData);
+ lpszNew = (XMLSTR)malloc((cbData+1) * sizeof(XMLCHAR));
+ if (lpszNew)
+ {
+ memcpy(lpszNew, lpszData, (cbData) * sizeof(XMLCHAR));
+ lpszNew[cbData] = (XMLCHAR)NULL;
+ }
+ return lpszNew;
+}
+
+XMLSTR toXMLStringUnSafe(XMLSTR dest,XMLCSTR source)
+{
+ XMLSTR dd=dest;
+ XMLCHAR ch;
+ XMLCharacterEntity *entity;
+ while ((ch=*source))
+ {
+ entity=XMLEntities;
+ do
+ {
+ if (ch==entity->c) {xstrcpy(dest,entity->s); dest+=entity->l; source++; goto out_of_loop1; }
+ entity++;
+ } while(entity->s);
+#ifdef _XMLWIDECHAR
+ *(dest++)=*(source++);
+#else
+ switch(XML_ByteTable[(unsigned char)ch])
+ {
+ case 4: *(dest++)=*(source++);
+ case 3: *(dest++)=*(source++);
+ case 2: *(dest++)=*(source++);
+ case 1: *(dest++)=*(source++);
+ }
+#endif
+out_of_loop1:
+ ;
+ }
+ *dest=0;
+ return dd;
+}
+
+// private (used while rendering):
+int lengthXMLString(XMLCSTR source)
+{
+ int r=0;
+ XMLCharacterEntity *entity;
+ XMLCHAR ch;
+ while ((ch=*source))
+ {
+ entity=XMLEntities;
+ do
+ {
+ if (ch==entity->c) { r+=entity->l; source++; goto out_of_loop1; }
+ entity++;
+ } while(entity->s);
+#ifdef _XMLWIDECHAR
+ r++; source++;
+#else
+ ch=XML_ByteTable[(unsigned char)ch]; r+=ch; source+=ch;
+#endif
+out_of_loop1:
+ ;
+ }
+ return r;
+}
+
+ToXMLStringTool::~ToXMLStringTool(){ freeBuffer(); }
+void ToXMLStringTool::freeBuffer(){ if (buf) free(buf); buf=NULL; buflen=0; }
+XMLSTR ToXMLStringTool::toXML(XMLCSTR source)
+{
+ int l=lengthXMLString(source)+1;
+ if (l>buflen) { buflen=l; buf=(XMLSTR)realloc(buf,l*sizeof(XMLCHAR)); }
+ return toXMLStringUnSafe(buf,source);
+}
+
+// private:
+XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML)
+{
+ // This function is the opposite of the function "toXMLString". It decodes the escape
+ // sequences &, ", ', <, > and replace them by the characters
+ // &,",',<,>. This function is used internally by the XML Parser. All the calls to
+ // the XML library will always gives you back "decoded" strings.
+ //
+ // in: string (s) and length (lo) of string
+ // out: new allocated string converted from xml
+ if (!s) return NULL;
+
+ int ll=0,j;
+ XMLSTR d;
+ XMLCSTR ss=s;
+ XMLCharacterEntity *entity;
+ while ((lo>0)&&(*s))
+ {
+ if (*s==_X('&'))
+ {
+ if ((lo>2)&&(s[1]==_X('#')))
+ {
+ s+=2; lo-=2;
+ if ((*s==_X('X'))||(*s==_X('x'))) { s++; lo--; }
+ while ((*s)&&(*s!=_X(';'))&&((lo--)>0)) s++;
+ if (*s!=_X(';'))
+ {
+ pXML->error=eXMLErrorUnknownCharacterEntity;
+ return NULL;
+ }
+ s++; lo--;
+ } else
+ {
+ entity=XMLEntities;
+ do
+ {
+ if ((lo>=entity->l)&&(xstrnicmp(s,entity->s,entity->l)==0)) { s+=entity->l; lo-=entity->l; break; }
+ entity++;
+ } while(entity->s);
+ if (!entity->s)
+ {
+ pXML->error=eXMLErrorUnknownCharacterEntity;
+ return NULL;
+ }
+ }
+ } else
+ {
+#ifdef _XMLWIDECHAR
+ s++; lo--;
+#else
+ j=XML_ByteTable[(unsigned char)*s]; s+=j; lo-=j; ll+=j-1;
+#endif
+ }
+ ll++;
+ }
+
+ d=(XMLSTR)malloc((ll+1)*sizeof(XMLCHAR));
+ s=d;
+ while (ll-->0)
+ {
+ if (*ss==_X('&'))
+ {
+ if (ss[1]==_X('#'))
+ {
+ ss+=2; j=0;
+ if ((*ss==_X('X'))||(*ss==_X('x')))
+ {
+ ss++;
+ while (*ss!=_X(';'))
+ {
+ if ((*ss>=_X('0'))&&(*ss<=_X('9'))) j=(j<<4)+*ss-_X('0');
+ else if ((*ss>=_X('A'))&&(*ss<=_X('F'))) j=(j<<4)+*ss-_X('A')+10;
+ else if ((*ss>=_X('a'))&&(*ss<=_X('f'))) j=(j<<4)+*ss-_X('a')+10;
+ else { free((void*)s); pXML->error=eXMLErrorUnknownCharacterEntity;return NULL;}
+ ss++;
+ }
+ } else
+ {
+ while (*ss!=_X(';'))
+ {
+ if ((*ss>=_X('0'))&&(*ss<=_X('9'))) j=(j*10)+*ss-_X('0');
+ else { free((void*)s); pXML->error=eXMLErrorUnknownCharacterEntity;return NULL;}
+ ss++;
+ }
+ }
+ (*d++)=(XMLCHAR)j; ss++;
+ } else
+ {
+ entity=XMLEntities;
+ do
+ {
+ if (xstrnicmp(ss,entity->s,entity->l)==0) { *(d++)=entity->c; ss+=entity->l; break; }
+ entity++;
+ } while(entity->s);
+ }
+ } else
+ {
+#ifdef _XMLWIDECHAR
+ *(d++)=*(ss++);
+#else
+ switch(XML_ByteTable[(unsigned char)*ss])
+ {
+ case 4: *(d++)=*(ss++); ll--;
+ case 3: *(d++)=*(ss++); ll--;
+ case 2: *(d++)=*(ss++); ll--;
+ case 1: *(d++)=*(ss++);
+ }
+#endif
+ }
+ }
+ *d=0;
+ return (XMLSTR)s;
+}
+
+#define XML_isSPACECHAR(ch) ((ch==_X('\n'))||(ch==_X(' '))||(ch== _X('\t'))||(ch==_X('\r')))
+
+// private:
+char myTagCompare(XMLCSTR cclose, XMLCSTR copen)
+// !!!! WARNING strange convention&:
+// return 0 if equals
+// return 1 if different
+{
+ if (!cclose) return 1;
+ int l=(int)xstrlen(cclose);
+ if (xstrnicmp(cclose, copen, l)!=0) return 1;
+ const XMLCHAR c=copen[l];
+ if (XML_isSPACECHAR(c)||
+ (c==_X('/' ))||
+ (c==_X('<' ))||
+ (c==_X('>' ))||
+ (c==_X('=' ))) return 0;
+ return 1;
+}
+
+// Obtain the next character from the string.
+static inline XMLCHAR getNextChar(XML *pXML)
+{
+ XMLCHAR ch = pXML->lpXML[pXML->nIndex];
+#ifdef _XMLWIDECHAR
+ if (ch!=0) pXML->nIndex++;
+#else
+ pXML->nIndex+=XML_ByteTable[(unsigned char)ch];
+#endif
+ return ch;
+}
+
+// Find the next token in a string.
+// pcbToken contains the number of characters that have been read.
+static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pType)
+{
+ NextToken result;
+ XMLCHAR ch;
+ XMLCHAR chTemp;
+ int indexStart,nFoundMatch,nIsText=FALSE;
+ result.pClr=NULL; // prevent warning
+
+ // Find next non-white space character
+ do { indexStart=pXML->nIndex; ch=getNextChar(pXML); } while XML_isSPACECHAR(ch);
+
+ if (ch)
+ {
+ // Cache the current string pointer
+ result.pStr = &pXML->lpXML[indexStart];
+
+ // First check whether the token is in the clear tag list (meaning it
+ // does not need formatting).
+ ALLXMLClearTag *ctag=XMLClearTags;
+ do
+ {
+ if (xstrncmp(ctag->lpszOpen, result.pStr, ctag->openTagLen)==0)
+ {
+ result.pClr=ctag;
+ pXML->nIndex+=ctag->openTagLen-1;
+ *pType=eTokenClear;
+ return result;
+ }
+ ctag++;
+ } while(ctag->lpszOpen);
+
+ // If we didn't find a clear tag then check for standard tokens
+ switch(ch)
+ {
+ // Check for quotes
+ case _X('\''):
+ case _X('\"'):
+ // Type of token
+ *pType = eTokenQuotedText;
+ chTemp = ch;
+
+ // Set the size
+ nFoundMatch = FALSE;
+
+ // Search through the string to find a matching quote
+ while((ch = getNextChar(pXML)))
+ {
+ if (ch==chTemp) { nFoundMatch = TRUE; break; }
+ if (ch==_X('<')) break;
+ }
+
+ // If we failed to find a matching quote
+ if (nFoundMatch == FALSE)
+ {
+ pXML->nIndex=indexStart+1;
+ nIsText=TRUE;
+ break;
+ }
+
+// 4.02.2002
+// if (FindNonWhiteSpace(pXML)) pXML->nIndex--;
+
+ break;
+
+ // Equals (used with attribute values)
+ case _X('='):
+ *pType = eTokenEquals;
+ break;
+
+ // Close tag
+ case _X('>'):
+ *pType = eTokenCloseTag;
+ break;
+
+ // Check for tag start and tag end
+ case _X('<'):
+
+ // Peek at the next character to see if we have an end tag '',
+ // or an xml declaration ''
+ chTemp = pXML->lpXML[pXML->nIndex];
+
+ // If we have a tag end...
+ if (chTemp == _X('/'))
+ {
+ // Set the type and ensure we point at the next character
+ getNextChar(pXML);
+ *pType = eTokenTagEnd;
+ }
+
+ // If we have an XML declaration tag
+ else if (chTemp == _X('?'))
+ {
+
+ // Set the type and ensure we point at the next character
+ getNextChar(pXML);
+ *pType = eTokenDeclaration;
+ }
+
+ // Otherwise we must have a start tag
+ else
+ {
+ *pType = eTokenTagStart;
+ }
+ break;
+
+ // Check to see if we have a short hand type end tag ('/>').
+ case _X('/'):
+
+ // Peek at the next character to see if we have a short end tag '/>'
+ chTemp = pXML->lpXML[pXML->nIndex];
+
+ // If we have a short hand end tag...
+ if (chTemp == _X('>'))
+ {
+ // Set the type and ensure we point at the next character
+ getNextChar(pXML);
+ *pType = eTokenShortHandClose;
+ break;
+ }
+
+ // If we haven't found a short hand closing tag then drop into the
+ // text process
+
+ // Other characters
+ default:
+ nIsText = TRUE;
+ }
+
+ // If this is a TEXT node
+ if (nIsText)
+ {
+ // Indicate we are dealing with text
+ *pType = eTokenText;
+ while((ch = getNextChar(pXML)))
+ {
+ if XML_isSPACECHAR(ch)
+ {
+ indexStart++; break;
+
+ } else if (ch==_X('/'))
+ {
+ // If we find a slash then this maybe text or a short hand end tag
+ // Peek at the next character to see it we have short hand end tag
+ ch=pXML->lpXML[pXML->nIndex];
+ // If we found a short hand end tag then we need to exit the loop
+ if (ch==_X('>')) { pXML->nIndex--; break; }
+
+ } else if ((ch==_X('<'))||(ch==_X('>'))||(ch==_X('=')))
+ {
+ pXML->nIndex--; break;
+ }
+ }
+ }
+ *pcbToken = pXML->nIndex-indexStart;
+ } else
+ {
+ // If we failed to obtain a valid character
+ *pcbToken = 0;
+ *pType = eTokenError;
+ result.pStr=NULL;
+ }
+
+ return result;
+}
+
+XMLCSTR XMLNode::updateName_WOSD(XMLSTR lpszName)
+{
+ if (!d) { free(lpszName); return NULL; }
+ if (d->lpszName&&(lpszName!=d->lpszName)) free((void*)d->lpszName);
+ d->lpszName=lpszName;
+ return lpszName;
+}
+
+// private:
+XMLNode::XMLNode(struct XMLNodeDataTag *p){ d=p; (p->ref_count)++; }
+XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration)
+{
+ d=(XMLNodeData*)malloc(sizeof(XMLNodeData));
+ d->ref_count=1;
+
+ d->lpszName=NULL;
+ d->nChild= 0;
+ d->nText = 0;
+ d->nClear = 0;
+ d->nAttribute = 0;
+
+ d->isDeclaration = isDeclaration;
+
+ d->pParent = pParent;
+ d->pChild= NULL;
+ d->pText= NULL;
+ d->pClear= NULL;
+ d->pAttribute= NULL;
+ d->pOrder= NULL;
+
+ updateName_WOSD(lpszName);
+}
+
+XMLNode XMLNode::createXMLTopNode_WOSD(XMLSTR lpszName, char isDeclaration) { return XMLNode(NULL,lpszName,isDeclaration); }
+XMLNode XMLNode::createXMLTopNode(XMLCSTR lpszName, char isDeclaration) { return XMLNode(NULL,stringDup(lpszName),isDeclaration); }
+
+#define MEMORYINCREASE 50
+
+static inline void myFree(void *p) { if (p) free(p); };
+static inline void *myRealloc(void *p, int newsize, int memInc, int sizeofElem)
+{
+ if (p==NULL) { if (memInc) return malloc(memInc*sizeofElem); return malloc(sizeofElem); }
+ if ((memInc==0)||((newsize%memInc)==0)) p=realloc(p,(newsize+memInc)*sizeofElem);
+// if (!p)
+// {
+// printf("XMLParser Error: Not enough memory! Aborting...\n"); exit(220);
+// }
+ return p;
+}
+
+// private:
+XMLElementPosition XMLNode::findPosition(XMLNodeData *d, int index, XMLElementType xxtype)
+{
+ if (index<0) return -1;
+ int i=0,j=(int)((index<<2)+xxtype),*o=d->pOrder; while (o[i]!=j) i++; return i;
+}
+
+// private:
+// update "order" information when deleting a content of a XMLNode
+int XMLNode::removeOrderElement(XMLNodeData *d, XMLElementType t, int index)
+{
+ int n=d->nChild+d->nText+d->nClear, *o=d->pOrder,i=findPosition(d,index,t);
+ memmove(o+i, o+i+1, (n-i)*sizeof(int));
+ for (;ipOrder=(int)realloc(d->pOrder,n*sizeof(int));
+ // but we skip reallocation because it's too time consuming.
+ // Anyway, at the end, it will be free'd completely at once.
+ return i;
+}
+
+void *XMLNode::addToOrder(int memoryIncrease,int *_pos, int nc, void *p, int size, XMLElementType xtype)
+{
+ // in: *_pos is the position inside d->pOrder ("-1" means "EndOf")
+ // out: *_pos is the index inside p
+ p=myRealloc(p,(nc+1),memoryIncrease,size);
+ int n=d->nChild+d->nText+d->nClear;
+ d->pOrder=(int*)myRealloc(d->pOrder,n+1,memoryIncrease*3,sizeof(int));
+ int pos=*_pos,*o=d->pOrder;
+
+ if ((pos<0)||(pos>=n)) { *_pos=nc; o[n]=(int)((nc<<2)+xtype); return p; }
+
+ int i=pos;
+ memmove(o+i+1, o+i, (n-i)*sizeof(int));
+
+ while ((pos>2;
+ memmove(((char*)p)+(pos+1)*size,((char*)p)+pos*size,(nc-pos)*size);
+
+ return p;
+}
+
+// Add a child node to the given element.
+XMLNode XMLNode::addChild_priv(int memoryIncrease, XMLSTR lpszName, char isDeclaration, int pos)
+{
+ if (!lpszName) return emptyXMLNode;
+ d->pChild=(XMLNode*)addToOrder(memoryIncrease,&pos,d->nChild,d->pChild,sizeof(XMLNode),eNodeChild);
+ d->pChild[pos].d=NULL;
+ d->pChild[pos]=XMLNode(d,lpszName,isDeclaration);
+ d->nChild++;
+ return d->pChild[pos];
+}
+
+// Add an attribute to an element.
+XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease,XMLSTR lpszName, XMLSTR lpszValuev)
+{
+ if (!lpszName) return &emptyXMLAttribute;
+ if (!d) { myFree(lpszName); myFree(lpszValuev); return &emptyXMLAttribute; }
+ int nc=d->nAttribute;
+ d->pAttribute=(XMLAttribute*)myRealloc(d->pAttribute,(nc+1),memoryIncrease,sizeof(XMLAttribute));
+ XMLAttribute *pAttr=d->pAttribute+nc;
+ pAttr->lpszName = lpszName;
+ pAttr->lpszValue = lpszValuev;
+ d->nAttribute++;
+ return pAttr;
+}
+
+// Add text to the element.
+XMLCSTR XMLNode::addText_priv(int memoryIncrease, XMLSTR lpszValue, int pos)
+{
+ if (!lpszValue) return NULL;
+ if (!d) { myFree(lpszValue); return NULL; }
+ d->pText=(XMLCSTR*)addToOrder(memoryIncrease,&pos,d->nText,d->pText,sizeof(XMLSTR),eNodeText);
+ d->pText[pos]=lpszValue;
+ d->nText++;
+ return lpszValue;
+}
+
+// Add clear (unformatted) text to the element.
+XMLClear *XMLNode::addClear_priv(int memoryIncrease, XMLSTR lpszValue, XMLCSTR lpszOpen, XMLCSTR lpszClose, int pos)
+{
+ if (!lpszValue) return &emptyXMLClear;
+ if (!d) { myFree(lpszValue); return &emptyXMLClear; }
+ d->pClear=(XMLClear *)addToOrder(memoryIncrease,&pos,d->nClear,d->pClear,sizeof(XMLClear),eNodeClear);
+ XMLClear *pNewClear=d->pClear+pos;
+ pNewClear->lpszValue = lpszValue;
+ if (!lpszOpen) lpszOpen=XMLClearTags->lpszOpen;
+ if (!lpszClose) lpszClose=XMLClearTags->lpszClose;
+ pNewClear->lpszOpenTag = lpszOpen;
+ pNewClear->lpszCloseTag = lpszClose;
+ d->nClear++;
+ return pNewClear;
+}
+
+// private:
+// Parse a clear (unformatted) type node.
+char XMLNode::parseClearTag(void *px, void *_pClear)
+{
+ XML *pXML=(XML *)px;
+ ALLXMLClearTag pClear=*((ALLXMLClearTag*)_pClear);
+ int cbTemp=0;
+ XMLCSTR lpszTemp=NULL;
+ XMLCSTR lpXML=&pXML->lpXML[pXML->nIndex];
+ static XMLCSTR docTypeEnd=_X("]>");
+
+ // Find the closing tag
+ // Seems the ')) { lpszTemp=pCh; break; }
+#ifdef _XMLWIDECHAR
+ pCh++;
+#else
+ pCh+=XML_ByteTable[(unsigned char)(*pCh)];
+#endif
+ }
+ } else lpszTemp=xstrstr(lpXML, pClear.lpszClose);
+
+ if (lpszTemp)
+ {
+ // Cache the size and increment the index
+ cbTemp = (int)(lpszTemp - lpXML);
+
+ pXML->nIndex += cbTemp+(int)xstrlen(pClear.lpszClose);
+
+ // Add the clear node to the current element
+ addClear_priv(MEMORYINCREASE,stringDup(lpXML,cbTemp), pClear.lpszOpen, pClear.lpszClose,-1);
+ return 0;
+ }
+
+ // If we failed to find the end tag
+ pXML->error = eXMLErrorUnmatchedEndClearTag;
+ return 1;
+}
+
+void XMLNode::exactMemory(XMLNodeData *d)
+{
+ if (d->pOrder) d->pOrder=(int*)realloc(d->pOrder,(d->nChild+d->nText+d->nClear)*sizeof(int));
+ if (d->pChild) d->pChild=(XMLNode*)realloc(d->pChild,d->nChild*sizeof(XMLNode));
+ if (d->pAttribute) d->pAttribute=(XMLAttribute*)realloc(d->pAttribute,d->nAttribute*sizeof(XMLAttribute));
+ if (d->pText) d->pText=(XMLCSTR*)realloc(d->pText,d->nText*sizeof(XMLSTR));
+ if (d->pClear) d->pClear=(XMLClear *)realloc(d->pClear,d->nClear*sizeof(XMLClear));
+}
+
+char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr)
+{
+ XML *pXML=(XML *)pa;
+ XMLCSTR lpszText=pXML->lpszText;
+ if (!lpszText) return 0;
+ if (dropWhiteSpace) while (XML_isSPACECHAR(*lpszText)&&(lpszText!=tokenPStr)) lpszText++;
+ int cbText = (int)(tokenPStr - lpszText);
+ if (!cbText) { pXML->lpszText=NULL; return 0; }
+ if (dropWhiteSpace) { cbText--; while ((cbText)&&XML_isSPACECHAR(lpszText[cbText])) cbText--; cbText++; }
+ if (!cbText) { pXML->lpszText=NULL; return 0; }
+ XMLSTR lpt=fromXMLString(lpszText,cbText,pXML);
+ if (!lpt) return 1;
+ addText_priv(MEMORYINCREASE,lpt,-1);
+ pXML->lpszText=NULL;
+ return 0;
+}
+// private:
+// Recursively parse an XML element.
+int XMLNode::ParseXMLElement(void *pa)
+{
+ XML *pXML=(XML *)pa;
+ int cbToken;
+ enum XMLTokenTypeTag xtype;
+ NextToken token;
+ XMLCSTR lpszTemp=NULL;
+ int cbTemp=0;
+ char nDeclaration;
+ XMLNode pNew;
+ enum Status status; // inside or outside a tag
+ enum Attrib attrib = eAttribName;
+
+ assert(pXML);
+
+ // If this is the first call to the function
+ if (pXML->nFirst)
+ {
+ // Assume we are outside of a tag definition
+ pXML->nFirst = FALSE;
+ status = eOutsideTag;
+ } else
+ {
+ // If this is not the first call then we should only be called when inside a tag.
+ status = eInsideTag;
+ }
+
+ // Iterate through the tokens in the document
+ for(;;)
+ {
+ // Obtain the next token
+ token = GetNextToken(pXML, &cbToken, &xtype);
+
+ if (xtype != eTokenError)
+ {
+ // Check the current status
+ switch(status)
+ {
+
+ // If we are outside of a tag definition
+ case eOutsideTag:
+
+ // Check what type of token we obtained
+ switch(xtype)
+ {
+ // If we have found text or quoted text
+ case eTokenText:
+ case eTokenCloseTag: /* '>' */
+ case eTokenShortHandClose: /* '/>' */
+ case eTokenQuotedText:
+ case eTokenEquals:
+ break;
+
+ // If we found a start tag '<' and declarations ''
+ case eTokenTagStart:
+ case eTokenDeclaration:
+
+ // Cache whether this new element is a declaration or not
+ nDeclaration = (xtype == eTokenDeclaration);
+
+ // If we have node text then add this to the element
+ if (maybeAddTxT(pXML,token.pStr)) return FALSE;
+
+ // Find the name of the tag
+ token = GetNextToken(pXML, &cbToken, &xtype);
+
+ // Return an error if we couldn't obtain the next token or
+ // it wasnt text
+ if (xtype != eTokenText)
+ {
+ pXML->error = eXMLErrorMissingTagName;
+ return FALSE;
+ }
+
+ // If we found a new element which is the same as this
+ // element then we need to pass this back to the caller..
+
+#ifdef APPROXIMATE_PARSING
+ if (d->lpszName &&
+ myTagCompare(d->lpszName, token.pStr) == 0)
+ {
+ // Indicate to the caller that it needs to create a
+ // new element.
+ pXML->lpNewElement = token.pStr;
+ pXML->cbNewElement = cbToken;
+ return TRUE;
+ } else
+#endif
+ {
+ // If the name of the new element differs from the name of
+ // the current element we need to add the new element to
+ // the current one and recurse
+ pNew = addChild_priv(MEMORYINCREASE,stringDup(token.pStr,cbToken), nDeclaration,-1);
+
+ while (!pNew.isEmpty())
+ {
+ // Callself to process the new node. If we return
+ // FALSE this means we dont have any more
+ // processing to do...
+
+ if (!pNew.ParseXMLElement(pXML)) return FALSE;
+ else
+ {
+ // If the call to recurse this function
+ // evented in a end tag specified in XML then
+ // we need to unwind the calls to this
+ // function until we find the appropriate node
+ // (the element name and end tag name must
+ // match)
+ if (pXML->cbEndTag)
+ {
+ // If we are back at the root node then we
+ // have an unmatched end tag
+ if (!d->lpszName)
+ {
+ pXML->error=eXMLErrorUnmatchedEndTag;
+ return FALSE;
+ }
+
+ // If the end tag matches the name of this
+ // element then we only need to unwind
+ // once more...
+
+ if (myTagCompare(d->lpszName, pXML->lpEndTag)==0)
+ {
+ pXML->cbEndTag = 0;
+ }
+
+ return TRUE;
+ } else
+ if (pXML->cbNewElement)
+ {
+ // If the call indicated a new element is to
+ // be created on THIS element.
+
+ // If the name of this element matches the
+ // name of the element we need to create
+ // then we need to return to the caller
+ // and let it process the element.
+
+ if (myTagCompare(d->lpszName, pXML->lpNewElement)==0)
+ {
+ return TRUE;
+ }
+
+ // Add the new element and recurse
+ pNew = addChild_priv(MEMORYINCREASE,stringDup(pXML->lpNewElement,pXML->cbNewElement),0,-1);
+ pXML->cbNewElement = 0;
+ }
+ else
+ {
+ // If we didn't have a new element to create
+ pNew = emptyXMLNode;
+
+ }
+ }
+ }
+ }
+ break;
+
+ // If we found an end tag
+ case eTokenTagEnd:
+
+ // If we have node text then add this to the element
+ if (maybeAddTxT(pXML,token.pStr)) return FALSE;
+
+ // Find the name of the end tag
+ token = GetNextToken(pXML, &cbTemp, &xtype);
+
+ // The end tag should be text
+ if (xtype != eTokenText)
+ {
+ pXML->error = eXMLErrorMissingEndTagName;
+ return FALSE;
+ }
+ lpszTemp = token.pStr;
+
+ // After the end tag we should find a closing tag
+ token = GetNextToken(pXML, &cbToken, &xtype);
+ if (xtype != eTokenCloseTag)
+ {
+ pXML->error = eXMLErrorMissingEndTagName;
+ return FALSE;
+ }
+ pXML->lpszText=pXML->lpXML+pXML->nIndex;
+
+ // We need to return to the previous caller. If the name
+ // of the tag cannot be found we need to keep returning to
+ // caller until we find a match
+ if (myTagCompare(d->lpszName, lpszTemp) != 0)
+#ifdef STRICT_PARSING
+ {
+ pXML->error=eXMLErrorUnmatchedEndTag;
+ pXML->nIndexMissigEndTag=pXML->nIndex;
+ return FALSE;
+ }
+#else
+ {
+ pXML->error=eXMLErrorMissingEndTag;
+ pXML->nIndexMissigEndTag=pXML->nIndex;
+ pXML->lpEndTag = lpszTemp;
+ pXML->cbEndTag = cbTemp;
+ }
+#endif
+
+ // Return to the caller
+ exactMemory(d);
+ return TRUE;
+
+ // If we found a clear (unformatted) token
+ case eTokenClear:
+ // If we have node text then add this to the element
+ if (maybeAddTxT(pXML,token.pStr)) return FALSE;
+ if (parseClearTag(pXML, token.pClr)) return FALSE;
+ pXML->lpszText=pXML->lpXML+pXML->nIndex;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ // If we are inside a tag definition we need to search for attributes
+ case eInsideTag:
+
+ // Check what part of the attribute (name, equals, value) we
+ // are looking for.
+ switch(attrib)
+ {
+ // If we are looking for a new attribute
+ case eAttribName:
+
+ // Check what the current token type is
+ switch(xtype)
+ {
+ // If the current type is text...
+ // Eg. 'attribute'
+ case eTokenText:
+ // Cache the token then indicate that we are next to
+ // look for the equals
+ lpszTemp = token.pStr;
+ cbTemp = cbToken;
+ attrib = eAttribEquals;
+ break;
+
+ // If we found a closing tag...
+ // Eg. '>'
+ case eTokenCloseTag:
+ // We are now outside the tag
+ status = eOutsideTag;
+ pXML->lpszText=pXML->lpXML+pXML->nIndex;
+ break;
+
+ // If we found a short hand '/>' closing tag then we can
+ // return to the caller
+ case eTokenShortHandClose:
+ exactMemory(d);
+ pXML->lpszText=pXML->lpXML+pXML->nIndex;
+ return TRUE;
+
+ // Errors...
+ case eTokenQuotedText: /* '"SomeText"' */
+ case eTokenTagStart: /* '<' */
+ case eTokenTagEnd: /* '' */
+ case eTokenEquals: /* '=' */
+ case eTokenDeclaration: /* '' */
+ case eTokenClear:
+ pXML->error = eXMLErrorUnexpectedToken;
+ return FALSE;
+ default: break;
+ }
+ break;
+
+ // If we are looking for an equals
+ case eAttribEquals:
+ // Check what the current token type is
+ switch(xtype)
+ {
+ // If the current type is text...
+ // Eg. 'Attribute AnotherAttribute'
+ case eTokenText:
+ // Add the unvalued attribute to the list
+ addAttribute_priv(MEMORYINCREASE,stringDup(lpszTemp,cbTemp), NULL);
+ // Cache the token then indicate. We are next to
+ // look for the equals attribute
+ lpszTemp = token.pStr;
+ cbTemp = cbToken;
+ break;
+
+ // If we found a closing tag 'Attribute >' or a short hand
+ // closing tag 'Attribute />'
+ case eTokenShortHandClose:
+ case eTokenCloseTag:
+ // If we are a declaration element '' then we need
+ // to remove extra closing '?' if it exists
+ pXML->lpszText=pXML->lpXML+pXML->nIndex;
+
+ if (d->isDeclaration &&
+ (lpszTemp[cbTemp-1]) == _X('?'))
+ {
+ cbTemp--;
+ }
+
+ if (cbTemp)
+ {
+ // Add the unvalued attribute to the list
+ addAttribute_priv(MEMORYINCREASE,stringDup(lpszTemp,cbTemp), NULL);
+ }
+
+ // If this is the end of the tag then return to the caller
+ if (xtype == eTokenShortHandClose)
+ {
+ exactMemory(d);
+ return TRUE;
+ }
+
+ // We are now outside the tag
+ status = eOutsideTag;
+ break;
+
+ // If we found the equals token...
+ // Eg. 'Attribute ='
+ case eTokenEquals:
+ // Indicate that we next need to search for the value
+ // for the attribute
+ attrib = eAttribValue;
+ break;
+
+ // Errors...
+ case eTokenQuotedText: /* 'Attribute "InvalidAttr"'*/
+ case eTokenTagStart: /* 'Attribute <' */
+ case eTokenTagEnd: /* 'Attribute ' */
+ case eTokenDeclaration: /* 'Attribute ' */
+ case eTokenClear:
+ pXML->error = eXMLErrorUnexpectedToken;
+ return FALSE;
+ default: break;
+ }
+ break;
+
+ // If we are looking for an attribute value
+ case eAttribValue:
+ // Check what the current token type is
+ switch(xtype)
+ {
+ // If the current type is text or quoted text...
+ // Eg. 'Attribute = "Value"' or 'Attribute = Value' or
+ // 'Attribute = 'Value''.
+ case eTokenText:
+ case eTokenQuotedText:
+ // If we are a declaration element '' then we need
+ // to remove extra closing '?' if it exists
+ if (d->isDeclaration &&
+ (token.pStr[cbToken-1]) == _X('?'))
+ {
+ cbToken--;
+ }
+
+ if (cbTemp)
+ {
+ // Add the valued attribute to the list
+ if (xtype==eTokenQuotedText) { token.pStr++; cbToken-=2; }
+ XMLSTR attrVal=(XMLSTR)token.pStr;
+ if (attrVal)
+ {
+ attrVal=fromXMLString(attrVal,cbToken,pXML);
+ if (!attrVal) return FALSE;
+ }
+ addAttribute_priv(MEMORYINCREASE,stringDup(lpszTemp,cbTemp),attrVal);
+ }
+
+ // Indicate we are searching for a new attribute
+ attrib = eAttribName;
+ break;
+
+ // Errors...
+ case eTokenTagStart: /* 'Attr = <' */
+ case eTokenTagEnd: /* 'Attr = ' */
+ case eTokenCloseTag: /* 'Attr = >' */
+ case eTokenShortHandClose: /* "Attr = />" */
+ case eTokenEquals: /* 'Attr = =' */
+ case eTokenDeclaration: /* 'Attr = ' */
+ case eTokenClear:
+ pXML->error = eXMLErrorUnexpectedToken;
+ return FALSE;
+ break;
+ default: break;
+ }
+ }
+ }
+ }
+ // If we failed to obtain the next token
+ else
+ {
+ if ((!d->isDeclaration)&&(d->pParent))
+ {
+#ifdef STRICT_PARSING
+ pXML->error=eXMLErrorUnmatchedEndTag;
+#else
+ pXML->error=eXMLErrorMissingEndTag;
+#endif
+ pXML->nIndexMissigEndTag=pXML->nIndex;
+ }
+ maybeAddTxT(pXML,pXML->lpXML+pXML->nIndex);
+ return FALSE;
+ }
+ }
+}
+
+// Count the number of lines and columns in an XML string.
+static void CountLinesAndColumns(XMLCSTR lpXML, int nUpto, XMLResults *pResults)
+{
+ XMLCHAR ch;
+ assert(lpXML);
+ assert(pResults);
+
+ struct XML xml={ lpXML,lpXML, 0, 0, eXMLErrorNone, NULL, 0, NULL, 0, TRUE };
+
+ pResults->nLine = 1;
+ pResults->nColumn = 1;
+ while (xml.nIndexnColumn++;
+ else
+ {
+ pResults->nLine++;
+ pResults->nColumn=1;
+ }
+ }
+}
+
+// Parse XML and return the root element.
+XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults)
+{
+ if (!lpszXML)
+ {
+ if (pResults)
+ {
+ pResults->error=eXMLErrorNoElements;
+ pResults->nLine=0;
+ pResults->nColumn=0;
+ }
+ return emptyXMLNode;
+ }
+
+ XMLNode xnode(NULL,NULL,FALSE);
+ struct XML xml={ lpszXML, lpszXML, 0, 0, eXMLErrorNone, NULL, 0, NULL, 0, TRUE };
+
+ // Create header element
+ xnode.ParseXMLElement(&xml);
+ enum XMLError error = xml.error;
+ if (!xnode.nChildNode()) error=eXMLErrorNoXMLTagFound;
+ if ((xnode.nChildNode()==1)&&(xnode.nElement()==1)) xnode=xnode.getChildNode(); // skip the empty node
+
+ // If no error occurred
+ if ((error==eXMLErrorNone)||(error==eXMLErrorMissingEndTag)||(error==eXMLErrorNoXMLTagFound))
+ {
+ XMLCSTR name=xnode.getName();
+ if (tag&&xstrlen(tag)&&((!name)||(xstricmp(xnode.getName(),tag))))
+ {
+ XMLNode nodeTmp;
+ int i=0;
+ while (i=xnode.nChildNode())
+ {
+ if (pResults)
+ {
+ pResults->error=eXMLErrorFirstTagNotFound;
+ pResults->nLine=0;
+ pResults->nColumn=0;
+ }
+ return emptyXMLNode;
+ }
+ xnode=nodeTmp;
+ }
+ } else
+ {
+ // Cleanup: this will destroy all the nodes
+ xnode = emptyXMLNode;
+ }
+
+
+ // If we have been given somewhere to place results
+ if (pResults)
+ {
+ pResults->error = error;
+
+ // If we have an error
+ if (error!=eXMLErrorNone)
+ {
+ if (error==eXMLErrorMissingEndTag) xml.nIndex=xml.nIndexMissigEndTag;
+ // Find which line and column it starts on.
+ CountLinesAndColumns(xml.lpXML, xml.nIndex, pResults);
+ }
+ }
+ return xnode;
+}
+
+XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults)
+{
+ if (pResults) { pResults->nLine=0; pResults->nColumn=0; }
+ FILE *f=xfopen(filename,_X("rb"));
+ if (f==NULL) { if (pResults) pResults->error=eXMLErrorFileNotFound; return emptyXMLNode; }
+ fseek(f,0,SEEK_END);
+ int l=ftell(f),headerSz=0;
+ if (!l) { if (pResults) pResults->error=eXMLErrorEmpty; fclose(f); return emptyXMLNode; }
+ fseek(f,0,SEEK_SET);
+ unsigned char *buf=(unsigned char*)malloc(l+4);
+ fread(buf,l,1,f);
+ fclose(f);
+ buf[l]=0;buf[l+1]=0;buf[l+2]=0;buf[l+3]=0;
+#ifdef _XMLWIDECHAR
+ if (guessWideCharChars)
+ {
+ if (!myIsTextWideChar(buf,l))
+ {
+ if ((buf[0]==0xef)&&(buf[1]==0xbb)&&(buf[2]==0xbf)) headerSz=3;
+ XMLSTR b2=myMultiByteToWideChar((const char*)(buf+headerSz));
+ free(buf); buf=(unsigned char*)b2; headerSz=0;
+ } else
+ {
+ if ((buf[0]==0xef)&&(buf[1]==0xff)) headerSz=2;
+ if ((buf[0]==0xff)&&(buf[1]==0xfe)) headerSz=2;
+ }
+ }
+#else
+ if (guessWideCharChars)
+ {
+ if (myIsTextWideChar(buf,l))
+ {
+ l/=sizeof(wchar_t);
+ if ((buf[0]==0xef)&&(buf[1]==0xff)) headerSz=2;
+ if ((buf[0]==0xff)&&(buf[1]==0xfe)) headerSz=2;
+ char *b2=myWideCharToMultiByte((const wchar_t*)(buf+headerSz));
+ free(buf); buf=(unsigned char*)b2; headerSz=0;
+ } else
+ {
+ if ((buf[0]==0xef)&&(buf[1]==0xbb)&&(buf[2]==0xbf)) headerSz=3;
+ }
+ }
+#endif
+
+ if (!buf) { if (pResults) pResults->error=eXMLErrorCharConversionError; return emptyXMLNode; }
+ XMLNode x=parseString((XMLSTR)(buf+headerSz),tag,pResults);
+ free(buf);
+ return x;
+}
+
+static inline void charmemset(XMLSTR dest,XMLCHAR c,int l) { while (l--) *(dest++)=c; }
+// private:
+// Creates an user friendly XML string from a given element with
+// appropriate white space and carriage returns.
+//
+// This recurses through all subnodes then adds contents of the nodes to the
+// string.
+int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nFormat)
+{
+ int nResult = 0;
+ int cb;
+ int cbElement;
+ int nChildFormat=-1;
+ int nElementI=pEntry->nChild+pEntry->nText+pEntry->nClear;
+ int i,j;
+
+ assert(pEntry);
+
+#define LENSTR(lpsz) (lpsz ? xstrlen(lpsz) : 0)
+
+ // If the element has no name then assume this is the head node.
+ cbElement = (int)LENSTR(pEntry->lpszName);
+
+ if (cbElement)
+ {
+ // "isDeclaration) lpszMarker[nResult++]=_X('?');
+ xstrcpy(&lpszMarker[nResult], pEntry->lpszName);
+ nResult+=cbElement;
+ lpszMarker[nResult++]=_X(' ');
+
+ } else
+ {
+ nResult+=cbElement+2+cb;
+ if (pEntry->isDeclaration) nResult++;
+ }
+
+ // Enumerate attributes and add them to the string
+ XMLAttribute *pAttr=pEntry->pAttribute;
+ for (i=0; inAttribute; i++)
+ {
+ // "Attrib
+ cb = (int)LENSTR(pAttr->lpszName);
+ if (cb)
+ {
+ if (lpszMarker) xstrcpy(&lpszMarker[nResult], pAttr->lpszName);
+ nResult += cb;
+ // "Attrib=Value "
+ if (pAttr->lpszValue)
+ {
+ cb=(int)lengthXMLString(pAttr->lpszValue);
+ if (lpszMarker)
+ {
+ lpszMarker[nResult]=_X('=');
+ lpszMarker[nResult+1]=_X('"');
+ if (cb) toXMLStringUnSafe(&lpszMarker[nResult+2],pAttr->lpszValue);
+ lpszMarker[nResult+cb+2]=_X('"');
+ }
+ nResult+=cb+3;
+ }
+ if (lpszMarker) lpszMarker[nResult] = _X(' ');
+ nResult++;
+ }
+ pAttr++;
+ }
+
+ if (pEntry->isDeclaration)
+ {
+ if (lpszMarker)
+ {
+ lpszMarker[nResult-1]=_X('?');
+ lpszMarker[nResult]=_X('>');
+ }
+ nResult++;
+ if (nFormat!=-1)
+ {
+ if (lpszMarker) lpszMarker[nResult]=_X('\n');
+ nResult++;
+ }
+ } else
+ // If there are child nodes we need to terminate the start tag
+ if (nElementI)
+ {
+ if (lpszMarker) lpszMarker[nResult-1]=_X('>');
+ if (nFormat!=-1)
+ {
+ if (lpszMarker) lpszMarker[nResult]=_X('\n');
+ nResult++;
+ }
+ } else nResult--;
+ }
+
+ // Calculate the child format for when we recurse. This is used to
+ // determine the number of spaces used for prefixes.
+ if (nFormat!=-1)
+ {
+ if (cbElement&&(!pEntry->isDeclaration)) nChildFormat=nFormat+1;
+ else nChildFormat=nFormat;
+ }
+
+ // Enumerate through remaining children
+ for (i=0; ipOrder[i];
+ switch((XMLElementType)(j&3))
+ {
+ // Text nodes
+ case eNodeText:
+ {
+ // "Text"
+ XMLCSTR pChild=pEntry->pText[j>>2];
+ cb = (int)lengthXMLString(pChild);
+ if (cb)
+ {
+ if (nFormat!=-1)
+ {
+ if (lpszMarker)
+ {
+ charmemset(&lpszMarker[nResult],INDENTCHAR,sizeof(XMLCHAR)*(nFormat + 1));
+ toXMLStringUnSafe(&lpszMarker[nResult+nFormat+1],pChild);
+ lpszMarker[nResult+nFormat+1+cb]=_X('\n');
+ }
+ nResult+=cb+nFormat+2;
+ } else
+ {
+ if (lpszMarker) toXMLStringUnSafe(&lpszMarker[nResult], pChild);
+ nResult += cb;
+ }
+ }
+ break;
+ }
+
+ // Clear type nodes
+ case eNodeClear:
+ {
+ XMLClear *pChild=pEntry->pClear+(j>>2);
+ // "OpenTag"
+ cb = (int)LENSTR(pChild->lpszOpenTag);
+ if (cb)
+ {
+ if (nFormat!=-1)
+ {
+ if (lpszMarker)
+ {
+ charmemset(&lpszMarker[nResult], INDENTCHAR, sizeof(XMLCHAR)*(nFormat + 1));
+ xstrcpy(&lpszMarker[nResult+nFormat+1], pChild->lpszOpenTag);
+ }
+ nResult+=cb+nFormat+1;
+ }
+ else
+ {
+ if (lpszMarker)xstrcpy(&lpszMarker[nResult], pChild->lpszOpenTag);
+ nResult += cb;
+ }
+ }
+
+ // "OpenTag Value"
+ cb = (int)LENSTR(pChild->lpszValue);
+ if (cb)
+ {
+ if (lpszMarker) xstrcpy(&lpszMarker[nResult], pChild->lpszValue);
+ nResult += cb;
+ }
+
+ // "OpenTag Value CloseTag"
+ cb = (int)LENSTR(pChild->lpszCloseTag);
+ if (cb)
+ {
+ if (lpszMarker) xstrcpy(&lpszMarker[nResult], pChild->lpszCloseTag);
+ nResult += cb;
+ }
+
+ if (nFormat!=-1)
+ {
+ if (lpszMarker) lpszMarker[nResult] = _X('\n');
+ nResult++;
+ }
+ break;
+ }
+
+ // Element nodes
+ case eNodeChild:
+ {
+ // Recursively add child nodes
+ nResult += CreateXMLStringR(pEntry->pChild[j>>2].d, lpszMarker ? lpszMarker + nResult : 0, nChildFormat);
+ break;
+ }
+ default: break;
+ }
+ }
+
+ if ((cbElement)&&(!pEntry->isDeclaration))
+ {
+ // If we have child entries we need to use long XML notation for
+ // closing the element - "blah blah blah"
+ if (nElementI)
+ {
+ // "\0"
+ if (lpszMarker)
+ {
+ if (nFormat != -1)
+ {
+ if (nFormat)
+ {
+ charmemset(&lpszMarker[nResult], INDENTCHAR,sizeof(XMLCHAR)*nFormat);
+ nResult+=nFormat;
+ }
+ }
+
+ xstrcpy(&lpszMarker[nResult], _X(""));
+ nResult += 2;
+ xstrcpy(&lpszMarker[nResult], pEntry->lpszName);
+ nResult += cbElement;
+
+ if (nFormat == -1)
+ {
+ xstrcpy(&lpszMarker[nResult], _X(">"));
+ nResult++;
+ } else
+ {
+ xstrcpy(&lpszMarker[nResult], _X(">\n"));
+ nResult+=2;
+ }
+ } else
+ {
+ if (nFormat != -1) nResult+=cbElement+4+nFormat;
+ else nResult+=cbElement+3;
+ }
+ } else
+ {
+ // If there are no children we can use shorthand XML notation -
+ // ""
+ // "/>\0"
+ if (lpszMarker)
+ {
+ if (nFormat == -1)
+ {
+ xstrcpy(&lpszMarker[nResult], _X("/>"));
+ nResult += 2;
+ }
+ else
+ {
+ xstrcpy(&lpszMarker[nResult], _X("/>\n"));
+ nResult += 3;
+ }
+ }
+ else
+ {
+ nResult += nFormat == -1 ? 2 : 3;
+ }
+ }
+ }
+
+ return nResult;
+}
+
+#undef LENSTR
+
+// Create an XML string
+// @param int nFormat - 0 if no formatting is required
+// otherwise nonzero for formatted text
+// with carriage returns and indentation.
+// @param int *pnSize - [out] pointer to the size of the
+// returned string not including the
+// NULL terminator.
+// @return XMLSTR - Allocated XML string, you must free
+// this with free().
+XMLSTR XMLNode::createXMLString(int nFormat, int *pnSize) const
+{
+ if (!d) { if (pnSize) *pnSize=0; return NULL; }
+
+ XMLSTR lpszResult = NULL;
+ int cbStr;
+
+ // Recursively Calculate the size of the XML string
+ if (!dropWhiteSpace) nFormat=0;
+ nFormat = nFormat ? 0 : -1;
+ cbStr = CreateXMLStringR(d, 0, nFormat);
+ assert(cbStr);
+ // Alllocate memory for the XML string + the NULL terminator and
+ // create the recursively XML string.
+ lpszResult=(XMLSTR)malloc((cbStr+1)*sizeof(XMLCHAR));
+ CreateXMLStringR(d, lpszResult, nFormat);
+ if (pnSize) *pnSize = cbStr;
+ return lpszResult;
+}
+
+int XMLNode::detachFromParent(XMLNodeData *d)
+{
+ XMLNode *pa=d->pParent->pChild;
+ int i=0;
+ while (((void*)(pa[i].d))!=((void*)d)) i++;
+ d->pParent->nChild--;
+ if (d->pParent->nChild) memmove(pa+i,pa+i+1,(d->pParent->nChild-i)*sizeof(XMLNode));
+ else { free(pa); d->pParent->pChild=NULL; }
+ return removeOrderElement(d->pParent,eNodeChild,i);
+}
+
+XMLNode::~XMLNode() { deleteNodeContent_priv(1,0); }
+void XMLNode::deleteNodeContent(){ deleteNodeContent_priv(0,1); }
+void XMLNode::deleteNodeContent_priv(char isInDestuctor, char force)
+{
+ if (!d) return;
+ if (isInDestuctor) (d->ref_count)--;
+ if ((d->ref_count==0)||force)
+ {
+ int i;
+ if (d->pParent) detachFromParent(d);
+ for(i=0; inChild; i++) { d->pChild[i].d->pParent=NULL; d->pChild[i].deleteNodeContent_priv(1,force); }
+ myFree(d->pChild);
+ for(i=0; inText; i++) free((void*)d->pText[i]);
+ myFree(d->pText);
+ for(i=0; inClear; i++) free((void*)d->pClear[i].lpszValue);
+ myFree(d->pClear);
+ for(i=0; inAttribute; i++)
+ {
+ free((void*)d->pAttribute[i].lpszName);
+ if (d->pAttribute[i].lpszValue) free((void*)d->pAttribute[i].lpszValue);
+ }
+ myFree(d->pAttribute);
+ myFree(d->pOrder);
+ myFree((void*)d->lpszName);
+ d->nChild=0; d->nText=0; d->nClear=0; d->nAttribute=0;
+ d->pChild=NULL; d->pText=NULL; d->pClear=NULL; d->pAttribute=NULL;
+ d->pOrder=NULL; d->lpszName=NULL; d->pParent=NULL;
+ }
+ if (d->ref_count==0)
+ {
+ free(d);
+ d=NULL;
+ }
+}
+
+XMLNode XMLNode::deepCopy() const
+{
+ if (!d) return XMLNode::emptyXMLNode;
+ XMLNode x(NULL,stringDup(d->lpszName),d->isDeclaration);
+ XMLNodeData *p=x.d;
+ int n=d->nAttribute;
+ if (n)
+ {
+ p->nAttribute=n; p->pAttribute=(XMLAttribute*)malloc(n*sizeof(XMLAttribute));
+ while (n--)
+ {
+ p->pAttribute[n].lpszName=stringDup(d->pAttribute[n].lpszName);
+ p->pAttribute[n].lpszValue=stringDup(d->pAttribute[n].lpszValue);
+ }
+ }
+ if (d->pOrder)
+ {
+ n=(d->nChild+d->nText+d->nClear)*sizeof(int); p->pOrder=(int*)malloc(n); memcpy(p->pOrder,d->pOrder,n);
+ }
+ n=d->nText;
+ if (n)
+ {
+ p->nText=n; p->pText=(XMLCSTR*)malloc(n*sizeof(XMLCSTR));
+ while(n--) p->pText[n]=stringDup(d->pText[n]);
+ }
+ n=d->nClear;
+ if (n)
+ {
+ p->nClear=n; p->pClear=(XMLClear*)malloc(n*sizeof(XMLClear));
+ while (n--)
+ {
+ p->pClear[n].lpszCloseTag=d->pClear[n].lpszCloseTag;
+ p->pClear[n].lpszOpenTag=d->pClear[n].lpszOpenTag;
+ p->pClear[n].lpszValue=stringDup(d->pClear[n].lpszValue);
+ }
+ }
+ n=d->nChild;
+ if (n)
+ {
+ p->nChild=n; p->pChild=(XMLNode*)malloc(n*sizeof(XMLNode));
+ while (n--)
+ {
+ p->pChild[n].d=NULL;
+ p->pChild[n]=d->pChild[n].deepCopy();
+ p->pChild[n].d->pParent=p;
+ }
+ }
+ return x;
+}
+
+XMLNode XMLNode::addChild(XMLNode childNode, int pos)
+{
+ XMLNodeData *dc=childNode.d;
+ if ((!dc)||(!d)) return childNode;
+ if (dc->pParent) { if ((detachFromParent(dc)<=pos)&&(dc->pParent==d)) pos--; } else dc->ref_count++;
+ dc->pParent=d;
+// int nc=d->nChild;
+// d->pChild=(XMLNode*)myRealloc(d->pChild,(nc+1),memoryIncrease,sizeof(XMLNode));
+ d->pChild=(XMLNode*)addToOrder(0,&pos,d->nChild,d->pChild,sizeof(XMLNode),eNodeChild);
+ d->pChild[pos].d=dc;
+ d->nChild++;
+ return childNode;
+}
+
+void XMLNode::deleteAttribute(int i)
+{
+ if ((!d)||(i<0)||(i>=d->nAttribute)) return;
+ d->nAttribute--;
+ XMLAttribute *p=d->pAttribute+i;
+ free((void*)p->lpszName);
+ if (p->lpszValue) free((void*)p->lpszValue);
+ if (d->nAttribute) memmove(p,p+1,(d->nAttribute-i)*sizeof(XMLAttribute)); else { free(p); d->pAttribute=NULL; }
+}
+
+void XMLNode::deleteAttribute(XMLAttribute *a){ if (a) deleteAttribute(a->lpszName); }
+void XMLNode::deleteAttribute(XMLCSTR lpszName)
+{
+ int j=0;
+ getAttribute(lpszName,&j);
+ if (j) deleteAttribute(j-1);
+}
+
+XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName,int i)
+{
+ if (!d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return NULL; }
+ if (i>=d->nAttribute)
+ {
+ if (lpszNewName) return addAttribute_WOSD(lpszNewName,lpszNewValue);
+ return NULL;
+ }
+ XMLAttribute *p=d->pAttribute+i;
+ if (p->lpszValue&&p->lpszValue!=lpszNewValue) free((void*)p->lpszValue);
+ p->lpszValue=lpszNewValue;
+ if (lpszNewName&&p->lpszName!=lpszNewName) { free((void*)p->lpszName); p->lpszName=lpszNewName; };
+ return p;
+}
+
+XMLAttribute *XMLNode::updateAttribute_WOSD(XMLAttribute *newAttribute, XMLAttribute *oldAttribute)
+{
+ if (oldAttribute) return updateAttribute_WOSD((XMLSTR)newAttribute->lpszValue,(XMLSTR)newAttribute->lpszName,oldAttribute->lpszName);
+ return addAttribute_WOSD((XMLSTR)newAttribute->lpszName,(XMLSTR)newAttribute->lpszValue);
+}
+
+XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName,XMLCSTR lpszOldName)
+{
+ int j=0;
+ getAttribute(lpszOldName,&j);
+ if (j) return updateAttribute_WOSD(lpszNewValue,lpszNewName,j-1);
+ else
+ {
+ if (lpszNewName) return addAttribute_WOSD(lpszNewName,lpszNewValue);
+ else return addAttribute_WOSD(stringDup(lpszOldName),lpszNewValue);
+ }
+}
+
+int XMLNode::indexText(XMLCSTR lpszValue) const
+{
+ if (!d) return -1;
+ int i,l=d->nText;
+ if (!lpszValue) { if (l) return 0; return -1; }
+ XMLCSTR *p=d->pText;
+ for (i=0; i=d->nText)) return;
+ d->nText--;
+ XMLCSTR *p=d->pText+i;
+ free((void*)*p);
+ if (d->nText) memmove(p,p+1,(d->nText-i)*sizeof(XMLCSTR)); else { free(p); d->pText=NULL; }
+ removeOrderElement(d,eNodeText,i);
+}
+
+void XMLNode::deleteText(XMLCSTR lpszValue) { deleteText(indexText(lpszValue)); }
+
+XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i)
+{
+ if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; }
+ if (i>=d->nText) return addText_WOSD(lpszNewValue);
+ XMLCSTR *p=d->pText+i;
+ if (*p!=lpszNewValue) { free((void*)*p); *p=lpszNewValue; }
+ return lpszNewValue;
+}
+
+XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue)
+{
+ if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; }
+ int i=indexText(lpszOldValue);
+ if (i>=0) return updateText_WOSD(lpszNewValue,i);
+ return addText_WOSD(lpszNewValue);
+}
+
+void XMLNode::deleteClear(int i)
+{
+ if ((!d)||(i<0)||(i>=d->nClear)) return;
+ d->nClear--;
+ XMLClear *p=d->pClear+i;
+ free((void*)p->lpszValue);
+ if (d->nClear) memmove(p,p+1,(d->nClear-i)*sizeof(XMLClear)); else { free(p); d->pClear=NULL; }
+ removeOrderElement(d,eNodeClear,i);
+}
+
+int XMLNode::indexClear(XMLCSTR lpszValue) const
+{
+ if (!d) return -1;
+ int i,l=d->nClear;
+ if (!lpszValue) { if (l) return 0; return -1; }
+ XMLClear *p=d->pClear;
+ for (i=0; ilpszValue); }
+
+XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i)
+{
+ if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; }
+ if (i>=d->nClear) return addClear_WOSD(lpszNewContent);
+ XMLClear *p=d->pClear+i;
+ if (lpszNewContent!=p->lpszValue) { free((void*)p->lpszValue); p->lpszValue=lpszNewContent; }
+ return p;
+}
+
+XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, XMLCSTR lpszOldValue)
+{
+ if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; }
+ int i=indexClear(lpszOldValue);
+ if (i>=0) return updateClear_WOSD(lpszNewContent,i);
+ return addClear_WOSD(lpszNewContent);
+}
+
+XMLClear *XMLNode::updateClear_WOSD(XMLClear *newP,XMLClear *oldP)
+{
+ if (oldP) return updateClear_WOSD((XMLSTR)newP->lpszValue,(XMLSTR)oldP->lpszValue);
+ return NULL;
+}
+
+XMLNode& XMLNode::operator=( const XMLNode& A )
+{
+ // shallow copy
+ if (this != &A)
+ {
+ deleteNodeContent_priv(1,0);
+ d=A.d;
+ if (d) (d->ref_count) ++ ;
+ }
+ return *this;
+}
+
+XMLNode::XMLNode(const XMLNode &A)
+{
+ // shallow copy
+ d=A.d;
+ if (d) (d->ref_count)++ ;
+}
+
+int XMLNode::nChildNode(XMLCSTR name) const
+{
+ if (!d) return 0;
+ int i,j=0,n=d->nChild;
+ XMLNode *pc=d->pChild;
+ for (i=0; id->lpszName, name)==0) j++;
+ pc++;
+ }
+ return j;
+}
+
+XMLNode XMLNode::getChildNode(XMLCSTR name, int *j) const
+{
+ if (!d) return emptyXMLNode;
+ int i=0,n=d->nChild;
+ if (j) i=*j;
+ XMLNode *pc=d->pChild+i;
+ for (; id->lpszName, name)==0)
+ {
+ if (j) *j=i+1;
+ return *pc;
+ }
+ pc++;
+ }
+ return emptyXMLNode;
+}
+
+XMLNode XMLNode::getChildNode(XMLCSTR name, int j) const
+{
+ if (!d) return emptyXMLNode;
+ int i=0;
+ while (j-->0) getChildNode(name,&i);
+ return getChildNode(name,&i);
+}
+
+XMLElementPosition XMLNode::positionOfText (int i) const { if (i>=d->nText ) i=d->nText-1; return findPosition(d,i,eNodeText ); }
+XMLElementPosition XMLNode::positionOfClear (int i) const { if (i>=d->nClear) i=d->nClear-1; return findPosition(d,i,eNodeClear); }
+XMLElementPosition XMLNode::positionOfChildNode(int i) const { if (i>=d->nChild) i=d->nChild-1; return findPosition(d,i,eNodeChild); }
+XMLElementPosition XMLNode::positionOfText (XMLCSTR lpszValue) const { return positionOfText (indexText (lpszValue)); }
+XMLElementPosition XMLNode::positionOfClear(XMLCSTR lpszValue) const { return positionOfClear(indexClear(lpszValue)); }
+XMLElementPosition XMLNode::positionOfClear(XMLClear *a) const { if (a) return positionOfClear(a->lpszValue); return positionOfClear(); }
+XMLElementPosition XMLNode::positionOfChildNode(XMLNode x) const
+{
+ if ((!d)||(!x.d)) return -1;
+ XMLNodeData *dd=x.d;
+ XMLNode *pc=d->pChild;
+ int i=d->nChild;
+ while (i--) if (pc[i].d==dd) return findPosition(d,i,eNodeChild);
+ return -1;
+}
+XMLElementPosition XMLNode::positionOfChildNode(XMLCSTR name, int count) const
+{
+ if (!name) return positionOfChildNode(count);
+ int j=0;
+ do { getChildNode(name,&j); if (j<0) return -1; } while (count--);
+ return findPosition(d,j-1,eNodeChild);
+}
+
+XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name,XMLCSTR attributeName,XMLCSTR attributeValue, int *k) const
+{
+ int i=0,j;
+ if (k) i=*k;
+ XMLNode x;
+ XMLCSTR t;
+ do
+ {
+ x=getChildNode(name,&i);
+ if (!x.isEmpty())
+ {
+ if (attributeValue)
+ {
+ j=0;
+ do
+ {
+ t=x.getAttribute(attributeName,&j);
+ if (t&&(xstricmp(attributeValue,t)==0)) { if (k) *k=i+1; return x; }
+ } while (t);
+ } else
+ {
+ if (x.isAttributeSet(attributeName)) { if (k) *k=i+1; return x; }
+ }
+ }
+ } while (!x.isEmpty());
+ return emptyXMLNode;
+}
+
+// Find an attribute on an node.
+XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const
+{
+ if (!d) return NULL;
+ int i=0,n=d->nAttribute;
+ if (j) i=*j;
+ XMLAttribute *pAttr=d->pAttribute+i;
+ for (; ilpszName, lpszAttrib)==0)
+ {
+ if (j) *j=i+1;
+ return pAttr->lpszValue;
+ }
+ pAttr++;
+ }
+ return NULL;
+}
+
+char XMLNode::isAttributeSet(XMLCSTR lpszAttrib) const
+{
+ if (!d) return FALSE;
+ int i,n=d->nAttribute;
+ XMLAttribute *pAttr=d->pAttribute;
+ for (i=0; ilpszName, lpszAttrib)==0)
+ {
+ return TRUE;
+ }
+ pAttr++;
+ }
+ return FALSE;
+}
+
+XMLCSTR XMLNode::getAttribute(XMLCSTR name, int j) const
+{
+ if (!d) return NULL;
+ int i=0;
+ while (j-->0) getAttribute(name,&i);
+ return getAttribute(name,&i);
+}
+
+XMLNodeContents XMLNode::enumContents(int i) const
+{
+ XMLNodeContents c;
+ if (!d) { c.etype=eNodeNULL; return c; }
+ if (inAttribute)
+ {
+ c.etype=eNodeAttribute;
+ c.attrib=d->pAttribute[i];
+ return c;
+ }
+ i-=d->nAttribute;
+ c.etype=(XMLElementType)(d->pOrder[i]&3);
+ i=(d->pOrder[i])>>2;
+ switch (c.etype)
+ {
+ case eNodeChild: c.child = d->pChild[i]; break;
+ case eNodeText: c.text = d->pText[i]; break;
+ case eNodeClear: c.clear = d->pClear[i]; break;
+ default: break;
+ }
+ return c;
+}
+
+XMLCSTR XMLNode::getName() const { if (!d) return NULL; return d->lpszName; }
+int XMLNode::nText() const { if (!d) return 0; return d->nText; }
+int XMLNode::nChildNode() const { if (!d) return 0; return d->nChild; }
+int XMLNode::nAttribute() const { if (!d) return 0; return d->nAttribute; }
+int XMLNode::nClear() const { if (!d) return 0; return d->nClear; }
+int XMLNode::nElement() const { if (!d) return 0; return d->nAttribute+d->nChild+d->nText+d->nClear; }
+XMLClear XMLNode::getClear (int i) const { if ((!d)||(i>=d->nClear )) return emptyXMLClear; return d->pClear[i]; }
+XMLAttribute XMLNode::getAttribute (int i) const { if ((!d)||(i>=d->nAttribute)) return emptyXMLAttribute; return d->pAttribute[i]; }
+XMLCSTR XMLNode::getAttributeName (int i) const { if ((!d)||(i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszName; }
+XMLCSTR XMLNode::getAttributeValue(int i) const { if ((!d)||(i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszValue; }
+XMLCSTR XMLNode::getText (int i) const { if ((!d)||(i>=d->nText )) return NULL; return d->pText[i]; }
+XMLNode XMLNode::getChildNode (int i) const { if ((!d)||(i>=d->nChild )) return emptyXMLNode; return d->pChild[i]; }
+XMLNode XMLNode::getParentNode ( ) const { if ((!d)||(!d->pParent )) return emptyXMLNode; return XMLNode(d->pParent); }
+char XMLNode::isDeclaration ( ) const { if (!d) return 0; return d->isDeclaration; }
+char XMLNode::isEmpty ( ) const { return (d==NULL); }
+XMLNode XMLNode::emptyNode ( ) { return XMLNode::emptyXMLNode; }
+
+XMLNode XMLNode::addChild(XMLCSTR lpszName, char isDeclaration, XMLElementPosition pos)
+ { return addChild_priv(0,stringDup(lpszName),isDeclaration,pos); }
+XMLNode XMLNode::addChild_WOSD(XMLSTR lpszName, char isDeclaration, XMLElementPosition pos)
+ { return addChild_priv(0,lpszName,isDeclaration,pos); }
+XMLAttribute *XMLNode::addAttribute(XMLCSTR lpszName, XMLCSTR lpszValue)
+ { return addAttribute_priv(0,stringDup(lpszName),stringDup(lpszValue)); }
+XMLAttribute *XMLNode::addAttribute_WOSD(XMLSTR lpszName, XMLSTR lpszValuev)
+ { return addAttribute_priv(0,lpszName,lpszValuev); }
+XMLCSTR XMLNode::addText(XMLCSTR lpszValue, XMLElementPosition pos)
+ { return addText_priv(0,stringDup(lpszValue),pos); }
+XMLCSTR XMLNode::addText_WOSD(XMLSTR lpszValue, XMLElementPosition pos)
+ { return addText_priv(0,lpszValue,pos); }
+XMLClear *XMLNode::addClear(XMLCSTR lpszValue, XMLCSTR lpszOpen, XMLCSTR lpszClose, XMLElementPosition pos)
+ { return addClear_priv(0,stringDup(lpszValue),lpszOpen,lpszClose,pos); }
+XMLClear *XMLNode::addClear_WOSD(XMLSTR lpszValue, XMLCSTR lpszOpen, XMLCSTR lpszClose, XMLElementPosition pos)
+ { return addClear_priv(0,lpszValue,lpszOpen,lpszClose,pos); }
+XMLCSTR XMLNode::updateName(XMLCSTR lpszName)
+ { return updateName_WOSD(stringDup(lpszName)); }
+XMLAttribute *XMLNode::updateAttribute(XMLAttribute *newAttribute, XMLAttribute *oldAttribute)
+ { return updateAttribute_WOSD(stringDup(newAttribute->lpszValue),stringDup(newAttribute->lpszName),oldAttribute->lpszName); }
+XMLAttribute *XMLNode::updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName,int i)
+ { return updateAttribute_WOSD(stringDup(lpszNewValue),stringDup(lpszNewName),i); }
+XMLAttribute *XMLNode::updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName,XMLCSTR lpszOldName)
+ { return updateAttribute_WOSD(stringDup(lpszNewValue),stringDup(lpszNewName),lpszOldName); }
+XMLCSTR XMLNode::updateText(XMLCSTR lpszNewValue, int i)
+ { return updateText_WOSD(stringDup(lpszNewValue),i); }
+XMLCSTR XMLNode::updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue)
+ { return updateText_WOSD(stringDup(lpszNewValue),lpszOldValue); }
+XMLClear *XMLNode::updateClear(XMLCSTR lpszNewContent, int i)
+ { return updateClear_WOSD(stringDup(lpszNewContent),i); }
+XMLClear *XMLNode::updateClear(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue)
+ { return updateClear_WOSD(stringDup(lpszNewValue),lpszOldValue); }
+XMLClear *XMLNode::updateClear(XMLClear *newP,XMLClear *oldP)
+ { return updateClear_WOSD(stringDup(newP->lpszValue),oldP->lpszValue); }
+
+char XMLNode::setGlobalOptions(XMLCharEncoding _characterEncoding, char _guessWideCharChars, char _dropWhiteSpace)
+{
+ guessWideCharChars=_guessWideCharChars; dropWhiteSpace=_dropWhiteSpace;
+#ifdef _XMLWIDECHAR
+ if (_characterEncoding) characterEncoding=_characterEncoding;
+#else
+ switch(_characterEncoding)
+ {
+ case encoding_UTF8: characterEncoding=_characterEncoding; XML_ByteTable=XML_utf8ByteTable; break;
+ case encoding_ascii: characterEncoding=_characterEncoding; XML_ByteTable=XML_asciiByteTable; break;
+ case encoding_ShiftJIS: characterEncoding=_characterEncoding; XML_ByteTable=XML_sjisByteTable; break;
+ default: return 1;
+ }
+#endif
+ return 0;
+}
+
+XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf,int l, char useXMLEncodingAttribute)
+{
+#ifdef _XMLWIDECHAR
+ return (XMLCharEncoding)0;
+#else
+ if (l<25) return (XMLCharEncoding)0;
+ if (guessWideCharChars&&(myIsTextWideChar(buf,l))) return (XMLCharEncoding)0;
+ unsigned char *b=(unsigned char*)buf;
+ if ((b[0]==0xef)&&(b[1]==0xbb)&&(b[2]==0xbf)) return encoding_UTF8;
+
+ // Match utf-8 model ?
+ XMLCharEncoding bestGuess=encoding_UTF8;
+ int i=0;
+ while (i>18 ];
+ *(curr++)=base64EncodeTable[(j>>12)&0x3f];
+ *(curr++)=base64EncodeTable[(j>> 6)&0x3f];
+ *(curr++)=base64EncodeTable[(j )&0x3f];
+ if (formatted) { if (!k) { *(curr++)=_X('\n'); k=18; } k--; }
+ }
+ eLen=inlen-eLen*3; // 0 - 2.
+ if (eLen==1)
+ {
+ *(curr++)=base64EncodeTable[ inbuf[0]>>2 ];
+ *(curr++)=base64EncodeTable[(inbuf[0]<<4)&0x3F];
+ *(curr++)=base64Fillchar;
+ *(curr++)=base64Fillchar;
+ } else if (eLen==2)
+ {
+ j=(inbuf[0]<<8)|inbuf[1];
+ *(curr++)=base64EncodeTable[ j>>10 ];
+ *(curr++)=base64EncodeTable[(j>> 4)&0x3f];
+ *(curr++)=base64EncodeTable[(j<< 2)&0x3f];
+ *(curr++)=base64Fillchar;
+ }
+ *(curr++)=0;
+ return (XMLSTR)buf;
+}
+
+unsigned int XMLParserBase64Tool::decodeSize(XMLCSTR data,XMLError *xe)
+{
+ if (xe) *xe=eXMLErrorNone;
+ int size=0;
+ unsigned char c;
+ //skip any extra characters (e.g. newlines or spaces)
+ while (*data)
+ {
+#ifdef _XMLWIDECHAR
+ if (*data>255) { if (xe) *xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
+#endif
+ c=base64DecodeTable[(unsigned char)(*data)];
+ if (c<97) size++;
+ else if (c==98) { if (xe) *xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
+ data++;
+ }
+ if (xe&&(size%4!=0)) *xe=eXMLErrorBase64DataSizeIsNotMultipleOf4;
+ if (size==0) return 0;
+ do { data--; size--; } while(*data==base64Fillchar); size++;
+ return (unsigned int)((size*3)/4);
+}
+
+unsigned char XMLParserBase64Tool::decode(XMLCSTR data, unsigned char *buf, int len, XMLError *xe)
+{
+ if (xe) *xe=eXMLErrorNone;
+ int i=0,p=0;
+ unsigned char d,c;
+ for(;;)
+ {
+
+#ifdef _XMLWIDECHAR
+#define BASE64DECODE_READ_NEXT_CHAR(c) \
+ do { \
+ if (data[i]>255){ c=98; break; } \
+ c=base64DecodeTable[(unsigned char)data[i++]]; \
+ }while (c==97); \
+ if(c==98){ if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
+#else
+#define BASE64DECODE_READ_NEXT_CHAR(c) \
+ do { c=base64DecodeTable[(unsigned char)data[i++]]; }while (c==97); \
+ if(c==98){ if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
+#endif
+
+ BASE64DECODE_READ_NEXT_CHAR(c)
+ if (c==99) { return 2; }
+ if (c==96)
+ {
+ if (p==(int)len) return 2;
+ if (xe) *xe=eXMLErrorBase64DecodeTruncatedData;
+ return 1;
+ }
+
+ BASE64DECODE_READ_NEXT_CHAR(d)
+ if ((d==99)||(d==96)) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (p==(int)len) { if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall; return 0; }
+ buf[p++]=(unsigned char)((c<<2)|((d>>4)&0x3));
+
+ BASE64DECODE_READ_NEXT_CHAR(c)
+ if (c==99) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (p==(int)len)
+ {
+ if (c==96) return 2;
+ if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall;
+ return 0;
+ }
+ if (c==96) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ buf[p++]=(unsigned char)(((d<<4)&0xf0)|((c>>2)&0xf));
+
+ BASE64DECODE_READ_NEXT_CHAR(d)
+ if (d==99 ) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ if (p==(int)len)
+ {
+ if (d==96) return 2;
+ if (xe) *xe=eXMLErrorBase64DecodeBufferTooSmall;
+ return 0;
+ }
+ if (d==96) { if (xe) *xe=eXMLErrorBase64DecodeTruncatedData; return 1; }
+ buf[p++]=(unsigned char)(((c<<6)&0xc0)|d);
+ }
+}
+#undef BASE64DECODE_READ_NEXT_CHAR
+
+void XMLParserBase64Tool::alloc(int newsize)
+{
+ if ((!buf)&&(newsize)) { buf=malloc(newsize); buflen=newsize; return; }
+ if (newsize>buflen) { buf=realloc(buf,newsize); buflen=newsize; }
+}
+
+unsigned char *XMLParserBase64Tool::decode(XMLCSTR data, int *outlen, XMLError *xe)
+{
+ if (xe) *xe=eXMLErrorNone;
+ unsigned int len=decodeSize(data,xe);
+ if (outlen) *outlen=len;
+ if (!len) return NULL;
+ alloc(len+1);
+ if(!decode(data,(unsigned char*)buf,len,xe)){ return NULL; }
+ return (unsigned char*)buf;
+}
+
Index: /code/branches/hud/src/xml/xmlParser.h
===================================================================
--- /code/branches/hud/src/xml/xmlParser.h (revision 252)
+++ /code/branches/hud/src/xml/xmlParser.h (revision 252)
@@ -0,0 +1,554 @@
+/**
+ ****************************************************************************
+ * XML.c - implementation file for basic XML parser written in ANSI C++
+ * for portability. It works by using recursion and a node tree for breaking
+ * down the elements of an XML document.
+ *
+ * @version V2.33
+ * @author Frank Vanden Berghen
+ *
+ * BSD license:
+ * Copyright (c) 2002, Frank Vanden Berghen
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Frank Vanden Berghen nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************
+ */
+#ifndef __INCLUDE_XML_NODE__
+#define __INCLUDE_XML_NODE__
+
+#include
+
+#ifdef _UNICODE
+// If you comment the next "define" line then the library will never "switch to" _UNICODE (wchar_t*) mode (16/32 bits per characters).
+// This is useful when you get error messages like:
+// 'XMLNode::openFileHelper' : cannot convert parameter 2 from 'const char [5]' to 'const wchar_t *'
+// The _XMLWIDECHAR preprocessor variable force the XMLParser library into either utf16/32-mode (the proprocessor variable
+// must be defined) or utf8-mode(the pre-processor variable must be undefined).
+#define _XMLWIDECHAR
+#endif
+
+#if defined(WIN32) || defined(UNDER_CE)
+// comment the next line if you are under windows and the compiler is not Microsoft Visual Studio (6.0 or .NET)
+#define _XMLWINDOWS
+#endif
+
+#ifdef XMLDLLENTRY
+#undef XMLDLLENTRY
+#endif
+#ifdef _USE_XMLPARSER_DLL
+#ifdef _DLL_EXPORTS_
+#define XMLDLLENTRY __declspec(dllexport)
+#else
+#define XMLDLLENTRY __declspec(dllimport)
+#endif
+#else
+#define XMLDLLENTRY
+#endif
+
+// uncomment the next line if you want no support for wchar_t* (no need for the or libraries anymore to compile)
+//#define XML_NO_WIDE_CHAR
+
+#ifdef XML_NO_WIDE_CHAR
+#undef _XMLWINDOWS
+#undef _XMLWIDECHAR
+#endif
+
+#ifdef _XMLWINDOWS
+#include
+#else
+#define XMLDLLENTRY
+#ifndef XML_NO_WIDE_CHAR
+#include // to have 'wcsrtombs' for ANSI version
+ // to have 'mbsrtowcs' for WIDECHAR version
+#endif
+#endif
+
+// Some common types for char set portable code
+#ifdef _XMLWIDECHAR
+ #ifndef _X
+ #define _X(c) L ## c
+ #endif
+ #define XMLCSTR const wchar_t *
+ #define XMLSTR wchar_t *
+ #define XMLCHAR wchar_t
+#else
+ #ifndef _X
+ #define _X(c) c
+ #endif
+ #define XMLCSTR const char *
+ #define XMLSTR char *
+ #define XMLCHAR char
+#endif
+#ifndef FALSE
+ #define FALSE 0
+#endif /* FALSE */
+#ifndef TRUE
+ #define TRUE 1
+#endif /* TRUE */
+
+
+// Enumeration for XML parse errors.
+typedef enum XMLError
+{
+ eXMLErrorNone = 0,
+ eXMLErrorMissingEndTag,
+ eXMLErrorNoXMLTagFound,
+ eXMLErrorEmpty,
+ eXMLErrorMissingTagName,
+ eXMLErrorMissingEndTagName,
+ eXMLErrorUnmatchedEndTag,
+ eXMLErrorUnmatchedEndClearTag,
+ eXMLErrorUnexpectedToken,
+ eXMLErrorNoElements,
+ eXMLErrorFileNotFound,
+ eXMLErrorFirstTagNotFound,
+ eXMLErrorUnknownCharacterEntity,
+ eXMLErrorCharConversionError,
+ eXMLErrorCannotOpenWriteFile,
+ eXMLErrorCannotWriteFile,
+
+ eXMLErrorBase64DataSizeIsNotMultipleOf4,
+ eXMLErrorBase64DecodeIllegalCharacter,
+ eXMLErrorBase64DecodeTruncatedData,
+ eXMLErrorBase64DecodeBufferTooSmall
+} XMLError;
+
+
+// Enumeration used to manage type of data. Use in conjunction with structure XMLNodeContents
+typedef enum XMLElementType
+{
+ eNodeChild=0,
+ eNodeAttribute=1,
+ eNodeText=2,
+ eNodeClear=3,
+ eNodeNULL=4
+} XMLElementType;
+
+// Structure used to obtain error details if the parse fails.
+typedef struct XMLResults
+{
+ enum XMLError error;
+ int nLine,nColumn;
+} XMLResults;
+
+// Structure for XML clear (unformatted) node (usually comments)
+typedef struct XMLClear {
+ XMLCSTR lpszValue; XMLCSTR lpszOpenTag; XMLCSTR lpszCloseTag;
+} XMLClear;
+
+// Structure for XML attribute.
+typedef struct XMLAttribute {
+ XMLCSTR lpszName; XMLCSTR lpszValue;
+} XMLAttribute;
+
+// XMLElementPosition are not interchangeable with simple indexes
+typedef int XMLElementPosition;
+
+struct XMLNodeContents;
+
+typedef struct XMLDLLENTRY XMLNode
+{
+ private:
+
+ struct XMLNodeDataTag;
+
+ // protected constructors: use one of these four methods to get your first instance of XMLNode:
+ // - parseString
+ // - parseFile
+ // - openFileHelper
+ // - createXMLTopNode
+ XMLNode(struct XMLNodeDataTag *pParent, XMLSTR lpszName, char isDeclaration);
+ XMLNode(struct XMLNodeDataTag *p);
+
+ public:
+
+ // You can create your first instance of XMLNode with these 4 functions:
+ // (see complete explanation of parameters below)
+
+ static XMLNode createXMLTopNode(XMLCSTR lpszName, char isDeclaration=FALSE);
+ static XMLNode parseString (XMLCSTR lpXMLString, XMLCSTR tag=NULL, XMLResults *pResults=NULL);
+ static XMLNode parseFile (XMLCSTR filename, XMLCSTR tag=NULL, XMLResults *pResults=NULL);
+ static XMLNode openFileHelper(XMLCSTR filename, XMLCSTR tag=NULL );
+
+ // The tag parameter should be the name of the first tag inside the XML file.
+ // If the tag parameter is omitted, the 3 functions return a node that represents
+ // the head of the xml document including the declaration term ( ... ?>).
+
+ // The "openFileHelper" reports to the screen all the warnings & errors that occurred during
+ // parsing of the XML file. Since each application has its own way to report and deal with errors,
+ // you should rather use the "parseFile" function to parse XML files and program yourself thereafter
+ // an "error reporting" tailored for your needs (instead of using the very crude "error reporting"
+ // mechanism included inside the "openFileHelper" function).
+
+ // If the XML document is corrupted:
+ // * The "openFileHelper" method will:
+ // - display an error message on the console (or inside a messageBox for windows).
+ // - stop execution (exit).
+ // I suggest that you write your own "openFileHelper" method tailored to your needs.
+ // * The 2 other methods will initialize the "pResults" variable with some information that
+ // can be used to trace the error.
+ // * If you still want to parse the file, you can use the APPROXIMATE_PARSING option as
+ // explained inside the note at the beginning of the "xmlParser.cpp" file.
+ // You can have a user-friendly explanation of the parsing error with this function:
+ static XMLCSTR getError(XMLError error);
+ static XMLCSTR getVersion();
+
+ XMLCSTR getName() const; // name of the node
+ XMLCSTR getText(int i=0) const; // return ith text field
+ int nText() const; // nbr of text field
+ XMLNode getParentNode() const; // return the parent node
+ XMLNode getChildNode(int i=0) const; // return ith child node
+ XMLNode getChildNode(XMLCSTR name, int i) const; // return ith child node with specific name
+ // (return an empty node if failing)
+ XMLNode getChildNode(XMLCSTR name, int *i=NULL) const; // return next child node with specific name
+ // (return an empty node if failing)
+ XMLNode getChildNodeWithAttribute(XMLCSTR tagName, // return child node with specific name/attribute
+ XMLCSTR attributeName, // (return an empty node if failing)
+ XMLCSTR attributeValue=NULL, //
+ int *i=NULL) const; //
+ int nChildNode(XMLCSTR name) const; // return the number of child node with specific name
+ int nChildNode() const; // nbr of child node
+ XMLAttribute getAttribute(int i=0) const; // return ith attribute
+ XMLCSTR getAttributeName(int i=0) const; // return ith attribute name
+ XMLCSTR getAttributeValue(int i=0) const; // return ith attribute value
+ char isAttributeSet(XMLCSTR name) const; // test if an attribute with a specific name is given
+ XMLCSTR getAttribute(XMLCSTR name, int i) const; // return ith attribute content with specific name
+ // (return a NULL if failing)
+ XMLCSTR getAttribute(XMLCSTR name, int *i=NULL) const; // return next attribute content with specific name
+ // (return a NULL if failing)
+ int nAttribute() const; // nbr of attribute
+ XMLClear getClear(int i=0) const; // return ith clear field (comments)
+ int nClear() const; // nbr of clear field
+ XMLSTR createXMLString(int nFormat=1, int *pnSize=NULL) const; // create XML string starting from current XMLNode
+ // if nFormat==0, no formatting is required
+ // otherwise this returns an user friendly XML string from a
+ // given element with appropriate white spaces and carriage returns.
+ // if pnSize is given it returns the size in character of the string.
+ XMLError writeToFile(XMLCSTR filename, const char *encoding=NULL, char nFormat=1) const;
+ // Save the content of an xmlNode inside a file.
+ // The nFormat parameter has the same meaning as in the
+ // createXMLString function. If the global parameter
+ // "characterEncoding==encoding_UTF8", then the "encoding" parameter is
+ // ignored and always set to "utf-8". If the global parameter
+ // "characterEncoding==encoding_ShiftJIS", then the "encoding" parameter
+ // is ignored and always set to "SHIFT-JIS". If "_XMLWIDECHAR=1", then
+ // the "encoding" parameter is ignored and always set to "utf-16".
+ // If no "encoding" parameter is given the "ISO-8859-1" encoding is used.
+ XMLNodeContents enumContents(XMLElementPosition i) const; // enumerate all the different contents (attribute,child,text,
+ // clear) of the current XMLNode. The order is reflecting
+ // the order of the original file/string.
+ // NOTE: 0 <= i < nElement();
+ int nElement() const; // nbr of different contents for current node
+ char isEmpty() const; // is this node Empty?
+ char isDeclaration() const; // is this node a declaration .... ?>
+ XMLNode deepCopy() const; // deep copy (duplicate/clone) a XMLNode
+ static XMLNode emptyNode(); // return XMLNode::emptyXMLNode;
+
+// to allow shallow/fast copy:
+ ~XMLNode();
+ XMLNode(const XMLNode &A);
+ XMLNode& operator=( const XMLNode& A );
+
+ XMLNode(): d(NULL){};
+ static XMLNode emptyXMLNode;
+ static XMLClear emptyXMLClear;
+ static XMLAttribute emptyXMLAttribute;
+
+ // The following functions allows you to create from scratch (or update) a XMLNode structure
+ // Start by creating your top node with the "createXMLTopNode" function and then add new nodes with the "addChild" function.
+ // The parameter 'pos' gives the position where the childNode, the text or the XMLClearTag will be inserted.
+ // The default value (pos=-1) inserts at the end. The value (pos=0) insert at the beginning (Insertion at the beginning is slower than at the end).
+ // REMARK: 0 <= pos < nChild()+nText()+nClear()
+ XMLNode addChild(XMLCSTR lpszName, char isDeclaration=FALSE, XMLElementPosition pos=-1);
+ XMLAttribute *addAttribute(XMLCSTR lpszName, XMLCSTR lpszValuev);
+ XMLCSTR addText(XMLCSTR lpszValue, XMLElementPosition pos=-1);
+ XMLClear *addClear(XMLCSTR lpszValue, XMLCSTR lpszOpen=NULL, XMLCSTR lpszClose=NULL, XMLElementPosition pos=-1);
+ // default values: lpszOpen =""
+ XMLNode addChild(XMLNode nodeToAdd, XMLElementPosition pos=-1); // If the "nodeToAdd" has some parents, it will be detached
+ // from it's parents before being attached to the current XMLNode
+ // Some update functions:
+ XMLCSTR updateName(XMLCSTR lpszName); // change node's name
+ XMLAttribute *updateAttribute(XMLAttribute *newAttribute, XMLAttribute *oldAttribute); // if the attribute to update is missing, a new one will be added
+ XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName=NULL,int i=0); // if the attribute to update is missing, a new one will be added
+ XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName,XMLCSTR lpszOldName); // set lpszNewName=NULL if you don't want to change the name of the attribute
+ // if the attribute to update is missing, a new one will be added
+ XMLCSTR updateText(XMLCSTR lpszNewValue, int i=0); // if the text to update is missing, a new one will be added
+ XMLCSTR updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); // if the text to update is missing, a new one will be added
+ XMLClear *updateClear(XMLCSTR lpszNewContent, int i=0); // if the clearTag to update is missing, a new one will be added
+ XMLClear *updateClear(XMLClear *newP,XMLClear *oldP); // if the clearTag to update is missing, a new one will be added
+ XMLClear *updateClear(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); // if the clearTag to update is missing, a new one will be added
+
+ // Some deletion functions:
+ void deleteNodeContent(); // delete the content of this XMLNode and the subtree.
+ void deleteAttribute(XMLCSTR lpszName);
+ void deleteAttribute(int i=0);
+ void deleteAttribute(XMLAttribute *anAttribute);
+ void deleteText(int i=0);
+ void deleteText(XMLCSTR lpszValue);
+ void deleteClear(int i=0);
+ void deleteClear(XMLClear *p);
+ void deleteClear(XMLCSTR lpszValue);
+
+ // The strings given as parameters for the following add and update methods (all these methods have
+ // a name with the postfix "_WOSD" that means "WithOut String Duplication" ) will be free'd by the
+ // XMLNode class. For example, it means that this is incorrect:
+ // xNode.addText_WOSD("foo");
+ // xNode.updateAttribute_WOSD("#newcolor" ,NULL,"color");
+ // In opposition, this is correct:
+ // xNode.addText("foo");
+ // xNode.addText_WOSD(stringDup("foo"));
+ // xNode.updateAttribute("#newcolor" ,NULL,"color");
+ // xNode.updateAttribute_WOSD(stringDup("#newcolor"),NULL,"color");
+ // Typically, you will never do:
+ // char *b=(char*)malloc(...);
+ // xNode.addText(b);
+ // free(b);
+ // ... but rather:
+ // char *b=(char*)malloc(...);
+ // xNode.addText_WOSD(b);
+ // ('free(b)' is performed by the XMLNode class)
+
+ static XMLNode createXMLTopNode_WOSD(XMLSTR lpszName, char isDeclaration=FALSE);
+ XMLNode addChild_WOSD(XMLSTR lpszName, char isDeclaration=FALSE, XMLElementPosition pos=-1);
+ XMLAttribute *addAttribute_WOSD(XMLSTR lpszName, XMLSTR lpszValue);
+ XMLCSTR addText_WOSD(XMLSTR lpszValue, XMLElementPosition pos=-1);
+ XMLClear *addClear_WOSD(XMLSTR lpszValue, XMLCSTR lpszOpen=NULL, XMLCSTR lpszClose=NULL, XMLElementPosition pos=-1);
+
+ XMLCSTR updateName_WOSD(XMLSTR lpszName);
+ XMLAttribute *updateAttribute_WOSD(XMLAttribute *newAttribute, XMLAttribute *oldAttribute);
+ XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName=NULL,int i=0);
+ XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName,XMLCSTR lpszOldName);
+ XMLCSTR updateText_WOSD(XMLSTR lpszNewValue, int i=0);
+ XMLCSTR updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue);
+ XMLClear *updateClear_WOSD(XMLSTR lpszNewContent, int i=0);
+ XMLClear *updateClear_WOSD(XMLClear *newP,XMLClear *oldP);
+ XMLClear *updateClear_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue);
+
+ // These are some useful functions when you want to insert a childNode, a text or a XMLClearTag in the
+ // middle (at a specified position) of a XMLNode tree already constructed. The value returned by these
+ // methods is to be used as last parameter (parameter 'pos') of addChild, addText or addClear.
+ XMLElementPosition positionOfText(int i=0) const;
+ XMLElementPosition positionOfText(XMLCSTR lpszValue) const;
+ XMLElementPosition positionOfClear(int i=0) const;
+ XMLElementPosition positionOfClear(XMLCSTR lpszValue) const;
+ XMLElementPosition positionOfClear(XMLClear *a) const;
+ XMLElementPosition positionOfChildNode(int i=0) const;
+ XMLElementPosition positionOfChildNode(XMLNode x) const;
+ XMLElementPosition positionOfChildNode(XMLCSTR name, int i=0) const; // return the position of the ith childNode with the specified name
+ // if (name==NULL) return the position of the ith childNode
+
+ // The setGlobalOptions function allows you to change tree global parameters that affect string&file
+ // parsing. First of all, you most-probably will never have to change these 3 global parameters.
+ // The return value of the setGlobalOptions function is "0" when there are no errors. If you try to
+ // set an unrecognized encoding then the return value will be "1" to signal an error.
+ //
+ // About the "guessWideCharChars" parameter:
+ // If "guessWideCharChars=1" and if this library is compiled in WideChar mode, then the
+ // "parseFile" and "openFileHelper" functions will test if the file contains ASCII
+ // characters. If this is the case, then the file will be loaded and converted in memory to
+ // WideChar before being parsed. If "guessWideCharChars=0", no conversion will
+ // be performed.
+ //
+ // If "guessWideCharChars=1" and if this library is compiled in ASCII/UTF8/char* mode, then the
+ // "parseFile" and "openFileHelper" functions will test if the file contains WideChar
+ // characters. If this is the case, then the file will be loaded and converted in memory to
+ // ASCII/UTF8/char* before being parsed. If "guessWideCharChars=0", no conversion will
+ // be performed
+ //
+ // Sometime, it's useful to set "guessWideCharChars=0" to disable any conversion
+ // because the test to detect the file-type (ASCII/UTF8/char* or WideChar) may fail (rarely).
+ //
+ // About the "characterEncoding" parameter:
+ // This parameter is only meaningful when compiling in char* mode (multibyte character mode).
+ // In wchar_t* (wide char mode), this parameter is ignored. This parameter should be one of the
+ // three currently recognized encodings: XMLNode::encoding_UTF8, XMLNode::encoding_ascii,
+ // XMLNode::encoding_ShiftJIS.
+ //
+ // About the "dropWhiteSpace" parameter:
+ // In most situations, text fields containing only white spaces (and carriage returns)
+ // are useless. Even more, these "empty" text fields are annoying because they increase the
+ // complexity of the user's code for parsing. So, 99% of the time, it's better to drop
+ // the "empty" text fields. However The XML specification indicates that no white spaces
+ // should be lost when parsing the file. So to be perfectly XML-compliant, you should set
+ // dropWhiteSpace=0. A note of caution: if you set "dropWhiteSpace=0", the parser will be
+ // slower and your code will be more complex.
+
+ // Enumeration for XML character encoding.
+ typedef enum XMLCharEncoding { encoding_UTF8=1, encoding_ascii=2, encoding_ShiftJIS=3 } XMLCharEncoding;
+
+ static char setGlobalOptions(XMLCharEncoding characterEncoding=XMLNode::encoding_UTF8, char guessWideCharChars=1, char dropWhiteSpace=1);
+
+ // The next function try to guess the character encoding. You most-probably will never
+ // have to use this function. It then returns the appropriate value of the global parameter
+ // "characterEncoding" described above. The guess is based on the content of a buffer of length
+ // "bufLen" bytes that contains the first bytes (minimum 25 bytes; 200 bytes is a good value) of the
+ // file to be parsed. The "openFileHelper" function is using this function to automatically compute
+ // the value of the "characterEncoding" global parameter. There are several heuristics used to do the
+ // guess. One of the heuristic is based on the "encoding" attribute. The original XML specifications
+ // forbids to use this attribute to do the guess but you can still use it if you set
+ // "useXMLEncodingAttribute" to 1 (this is the default behavior and the behavior of most parsers).
+ // If an inconsistency in the encoding is detected, then the return value is "0".
+
+ static XMLCharEncoding guessCharEncoding(void *buffer, int bufLen, char useXMLEncodingAttribute=1);
+
+ private:
+
+// these are functions and structures used internally by the XMLNode class (don't bother about them):
+
+ typedef struct XMLNodeDataTag // to allow shallow copy and "intelligent/smart" pointers (automatic delete):
+ {
+ XMLCSTR lpszName; // Element name (=NULL if root)
+ int nChild, // Number of child nodes
+ nText, // Number of text fields
+ nClear, // Number of Clear fields (comments)
+ nAttribute; // Number of attributes
+ char isDeclaration; // Whether node is an XML declaration - ''
+ struct XMLNodeDataTag *pParent; // Pointer to parent element (=NULL if root)
+ XMLNode *pChild; // Array of child nodes
+ XMLCSTR *pText; // Array of text fields
+ XMLClear *pClear; // Array of clear fields
+ XMLAttribute *pAttribute; // Array of attributes
+ int *pOrder; // order of the child_nodes,text_fields,clear_fields
+ int ref_count; // for garbage collection (smart pointers)
+ } XMLNodeData;
+ XMLNodeData *d;
+
+ char parseClearTag(void *px, void *pa);
+ char maybeAddTxT(void *pa, XMLCSTR tokenPStr);
+ int ParseXMLElement(void *pXML);
+ void *addToOrder(int memInc, int *_pos, int nc, void *p, int size, XMLElementType xtype);
+ int indexText(XMLCSTR lpszValue) const;
+ int indexClear(XMLCSTR lpszValue) const;
+ XMLNode addChild_priv(int,XMLSTR,char,int);
+ XMLAttribute *addAttribute_priv(int,XMLSTR,XMLSTR);
+ XMLCSTR addText_priv(int,XMLSTR,int);
+ XMLClear *addClear_priv(int,XMLSTR,XMLCSTR,XMLCSTR,int);
+ void deleteNodeContent_priv(char,char);
+ static inline XMLElementPosition findPosition(XMLNodeData *d, int index, XMLElementType xtype);
+ static int CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nFormat);
+ static int removeOrderElement(XMLNodeData *d, XMLElementType t, int index);
+ static void exactMemory(XMLNodeData *d);
+ static int detachFromParent(XMLNodeData *d);
+} XMLNode;
+
+// This structure is given by the function "enumContents".
+typedef struct XMLNodeContents
+{
+ // This dictates what's the content of the XMLNodeContent
+ enum XMLElementType etype;
+ // should be an union to access the appropriate data.
+ // compiler does not allow union of object with constructor... too bad.
+ XMLNode child;
+ XMLAttribute attrib;
+ XMLCSTR text;
+ XMLClear clear;
+
+} XMLNodeContents;
+
+XMLDLLENTRY void freeXMLString(XMLSTR t); // {free(t);}
+
+// Duplicate (copy in a new allocated buffer) the source string. This is
+// a very handy function when used with all the "XMLNode::*_WOSD" functions.
+// (If (cbData!=0) then cbData is the number of chars to duplicate)
+XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData=0);
+
+// The following class is processing strings so that all the characters
+// &,",',<,> are replaced by their XML equivalent: &, ", ', <, >.
+// This class is useful when creating from scratch an XML file using the
+// "printf", "fprintf", "cout",... functions. If you are creating from scratch an
+// XML file using the provided XMLNode class you must not use the "ToXMLStringTool"
+// class (the "XMLNode" class does the processing job for you during rendering).
+// Using the "ToXMLStringTool class" and the "fprintf function" is THE most efficient
+// way to produce VERY large XML documents VERY fast.
+typedef struct XMLDLLENTRY ToXMLStringTool
+{
+public:
+ ToXMLStringTool(): buf(NULL),buflen(0){}
+ ~ToXMLStringTool();
+ void freeBuffer();
+
+ XMLSTR toXML(XMLCSTR source);
+
+ // The next function is deprecated because there is a possibility of
+ // "destination-buffer-overflow". It converts the string
+ // "source" to the string "dest".
+ static XMLSTR toXMLUnSafe(XMLSTR dest,XMLCSTR source);
+
+private:
+ XMLSTR buf;
+ int buflen;
+}ToXMLStringTool;
+
+// Below is a class that allows you to include any binary data (images, sounds,...)
+// into an XML document using "Base64 encoding". This class is completely
+// separated from the rest of the xmlParser library and can be removed without any problem.
+// To include some binary data into an XML file, you must convert the binary data into
+// standard text (using "encode"). To retrieve the original binary data from the
+// b64-encoded text included inside the XML file use "decode". Alternatively, these
+// functions can also be used to "encrypt/decrypt" some critical data contained inside
+// the XML (it's not a strong encryption at all, but sometimes it can be useful).
+
+typedef struct XMLDLLENTRY XMLParserBase64Tool
+{
+public:
+ XMLParserBase64Tool(): buf(NULL),buflen(0){}
+ ~XMLParserBase64Tool();
+ void freeBuffer();
+
+ // returns the length of the base64 string that encodes a data buffer of size inBufLen bytes.
+ // If "formatted" parameter is true, some space will be reserved for a carriage-return every 72 chars.
+ static int encodeLength(int inBufLen, char formatted=0);
+
+ // The "base64Encode" function returns a string containing the base64 encoding of "inByteLen" bytes
+ // from "inByteBuf". If "formatted" parameter is true, then there will be a carriage-return every 72 chars.
+ // The string will be free'd when the XMLParserBase64Tool object is deleted.
+ // All returned strings are sharing the same memory space.
+ XMLSTR encode(unsigned char *inByteBuf, unsigned int inByteLen, char formatted=0);
+
+ // returns the number of bytes which will be decoded from "inString".
+ static unsigned int decodeSize(XMLCSTR inString, XMLError *xe=NULL);
+
+ // returns a pointer to a buffer containing the binary data decoded from "inString"
+ // If "inString" is malformed NULL will be returned
+ // The output buffer will be free'd when the XMLParserBase64Tool object is deleted.
+ // All output buffer are sharing the same memory space.
+ unsigned char* decode(XMLCSTR inString, int *outByteLen=NULL, XMLError *xe=NULL);
+
+ // The next function is deprecated.
+ // decodes data from "inString" to "outByteBuf". You need to provide the size (in byte) of "outByteBuf"
+ // in "inMaxByteOutBuflen". If "outByteBuf" is not large enough or if data is malformed, then "FALSE"
+ // will be returned; otherwise "TRUE".
+ static unsigned char decode(XMLCSTR inString, unsigned char *outByteBuf, int inMaxByteOutBuflen, XMLError *xe=NULL);
+
+private:
+ void *buf;
+ int buflen;
+ void alloc(int newsize);
+}XMLParserBase64Tool;
+
+#undef XMLDLLENTRY
+
+#endif